********************************************************************************
** 	TITLE:		ca2004_2008_ces_contact_networks                              **
**	AUTHOR:	    Philippe Mongrain                                             **
**	DATA:       CES2004-6-8                                                   **
**	DATE:		October 2022 					                              **	
**	VERSION:	Stata 16					                                  **
********************************************************************************

* Version control

version 16.0

* Open log file

capture log close
log using "ca2004_2008_ces_contact_networks", replace

* Open dataset

use "CES2004-6-8.dta", clear

* Canadian Election Study

gen ces_year = 2004 if survey == 4
replace ces_year = 2006 if survey == 6
replace ces_year = 2008 if ces08_cps_intyear == 2008

bysort ces_year : gen id = _n


****************************************************
** DISTRICT-LEVEL OUTCOMES: 2004 FEDERAL ELECTION **
****************************************************

* Note: 1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 5 = GPC, 88 = independent

gen CA04_district_outcome = .

replace CA04_district_outcome = 1 if ces04_fed03 == 10001 
replace CA04_district_outcome = 1 if ces04_fed03 == 10002 
replace CA04_district_outcome = 1 if ces04_fed03 == 10003 
replace CA04_district_outcome = 1 if ces04_fed03 == 10004 
replace CA04_district_outcome = 1 if ces04_fed03 == 10005 
replace CA04_district_outcome = 2 if ces04_fed03 == 10006 
replace CA04_district_outcome = 2 if ces04_fed03 == 10007 
replace CA04_district_outcome = 1 if ces04_fed03 == 11001 
replace CA04_district_outcome = 1 if ces04_fed03 == 11002 
replace CA04_district_outcome = 1 if ces04_fed03 == 11003 
replace CA04_district_outcome = 1 if ces04_fed03 == 11004 
replace CA04_district_outcome = 1 if ces04_fed03 == 12001 
replace CA04_district_outcome = 2 if ces04_fed03 == 12002 
replace CA04_district_outcome = 1 if ces04_fed03 == 12003 
replace CA04_district_outcome = 3 if ces04_fed03 == 12004 
replace CA04_district_outcome = 1 if ces04_fed03 == 12005 
replace CA04_district_outcome = 1 if ces04_fed03 == 12006 
replace CA04_district_outcome = 2 if ces04_fed03 == 12007 
replace CA04_district_outcome = 3 if ces04_fed03 == 12008 
replace CA04_district_outcome = 2 if ces04_fed03 == 12009 
replace CA04_district_outcome = 1 if ces04_fed03 == 12010 
replace CA04_district_outcome = 1 if ces04_fed03 == 12011 
replace CA04_district_outcome = 3 if ces04_fed03 == 13001 
replace CA04_district_outcome = 1 if ces04_fed03 == 13002 
replace CA04_district_outcome = 1 if ces04_fed03 == 13003 
replace CA04_district_outcome = 2 if ces04_fed03 == 13004 
replace CA04_district_outcome = 1 if ces04_fed03 == 13005 
replace CA04_district_outcome = 1 if ces04_fed03 == 13006 
replace CA04_district_outcome = 1 if ces04_fed03 == 13007 
replace CA04_district_outcome = 2 if ces04_fed03 == 13008 
replace CA04_district_outcome = 1 if ces04_fed03 == 13009 
replace CA04_district_outcome = 1 if ces04_fed03 == 13010 
replace CA04_district_outcome = 4 if ces04_fed03 == 24001 
replace CA04_district_outcome = 1 if ces04_fed03 == 24002 
replace CA04_district_outcome = 4 if ces04_fed03 == 24003 
replace CA04_district_outcome = 4 if ces04_fed03 == 24004 
replace CA04_district_outcome = 1 if ces04_fed03 == 24005 
replace CA04_district_outcome = 4 if ces04_fed03 == 24006 
replace CA04_district_outcome = 4 if ces04_fed03 == 24007 
replace CA04_district_outcome = 4 if ces04_fed03 == 24008 
replace CA04_district_outcome = 1 if ces04_fed03 == 24009 
replace CA04_district_outcome = 1 if ces04_fed03 == 24010 
replace CA04_district_outcome = 1 if ces04_fed03 == 24011 
replace CA04_district_outcome = 4 if ces04_fed03 == 24012 
replace CA04_district_outcome = 4 if ces04_fed03 == 24013 
replace CA04_district_outcome = 4 if ces04_fed03 == 24014 
replace CA04_district_outcome = 4 if ces04_fed03 == 24015 
replace CA04_district_outcome = 4 if ces04_fed03 == 24016 
replace CA04_district_outcome = 4 if ces04_fed03 == 24017 
replace CA04_district_outcome = 4 if ces04_fed03 == 24018 
replace CA04_district_outcome = 4 if ces04_fed03 == 24019 
replace CA04_district_outcome = 1 if ces04_fed03 == 24020 
replace CA04_district_outcome = 4 if ces04_fed03 == 24021 
replace CA04_district_outcome = 1 if ces04_fed03 == 24022 
replace CA04_district_outcome = 1 if ces04_fed03 == 24023 
replace CA04_district_outcome = 1 if ces04_fed03 == 24024 
replace CA04_district_outcome = 4 if ces04_fed03 == 24025 
replace CA04_district_outcome = 4 if ces04_fed03 == 24026 
replace CA04_district_outcome = 1 if ces04_fed03 == 24027 
replace CA04_district_outcome = 4 if ces04_fed03 == 24028 
replace CA04_district_outcome = 1 if ces04_fed03 == 24029 
replace CA04_district_outcome = 4 if ces04_fed03 == 24030 
replace CA04_district_outcome = 4 if ces04_fed03 == 24031 
replace CA04_district_outcome = 4 if ces04_fed03 == 24032 
replace CA04_district_outcome = 1 if ces04_fed03 == 24033 
replace CA04_district_outcome = 4 if ces04_fed03 == 24034 
replace CA04_district_outcome = 4 if ces04_fed03 == 24035 
replace CA04_district_outcome = 4 if ces04_fed03 == 24036 
replace CA04_district_outcome = 4 if ces04_fed03 == 24037 
replace CA04_district_outcome = 4 if ces04_fed03 == 24038 
replace CA04_district_outcome = 4 if ces04_fed03 == 24039 
replace CA04_district_outcome = 4 if ces04_fed03 == 24040 
replace CA04_district_outcome = 4 if ces04_fed03 == 24041 
replace CA04_district_outcome = 4 if ces04_fed03 == 24042 
replace CA04_district_outcome = 4 if ces04_fed03 == 24043 
replace CA04_district_outcome = 1 if ces04_fed03 == 24044 
replace CA04_district_outcome = 1 if ces04_fed03 == 24045 
replace CA04_district_outcome = 4 if ces04_fed03 == 24046 
replace CA04_district_outcome = 1 if ces04_fed03 == 24047 
replace CA04_district_outcome = 1 if ces04_fed03 == 24048 
replace CA04_district_outcome = 1 if ces04_fed03 == 24049 
replace CA04_district_outcome = 1 if ces04_fed03 == 24050 
replace CA04_district_outcome = 4 if ces04_fed03 == 24051 
replace CA04_district_outcome = 4 if ces04_fed03 == 24052 
replace CA04_district_outcome = 4 if ces04_fed03 == 24053 
replace CA04_district_outcome = 4 if ces04_fed03 == 24054 
replace CA04_district_outcome = 4 if ces04_fed03 == 24055 
replace CA04_district_outcome = 4 if ces04_fed03 == 24056 
replace CA04_district_outcome = 4 if ces04_fed03 == 24057 
replace CA04_district_outcome = 4 if ces04_fed03 == 24058 
replace CA04_district_outcome = 4 if ces04_fed03 == 24059 
replace CA04_district_outcome = 4 if ces04_fed03 == 24060 
replace CA04_district_outcome = 4 if ces04_fed03 == 24061 
replace CA04_district_outcome = 4 if ces04_fed03 == 24062 
replace CA04_district_outcome = 4 if ces04_fed03 == 24063 
replace CA04_district_outcome = 4 if ces04_fed03 == 24064 
replace CA04_district_outcome = 4 if ces04_fed03 == 24065 
replace CA04_district_outcome = 1 if ces04_fed03 == 24066 
replace CA04_district_outcome = 1 if ces04_fed03 == 24067 
replace CA04_district_outcome = 4 if ces04_fed03 == 24068 
replace CA04_district_outcome = 4 if ces04_fed03 == 24069 
replace CA04_district_outcome = 4 if ces04_fed03 == 24070 
replace CA04_district_outcome = 4 if ces04_fed03 == 24071 
replace CA04_district_outcome = 4 if ces04_fed03 == 24072 
replace CA04_district_outcome = 4 if ces04_fed03 == 24073 
replace CA04_district_outcome = 4 if ces04_fed03 == 24074 
replace CA04_district_outcome = 1 if ces04_fed03 == 24075 
replace CA04_district_outcome = 1 if ces04_fed03 == 35001 
replace CA04_district_outcome = 1 if ces04_fed03 == 35002 
replace CA04_district_outcome = 1 if ces04_fed03 == 35003 
replace CA04_district_outcome = 1 if ces04_fed03 == 35004 
replace CA04_district_outcome = 1 if ces04_fed03 == 35005 
replace CA04_district_outcome = 1 if ces04_fed03 == 35006 
replace CA04_district_outcome = 1 if ces04_fed03 == 35007 
replace CA04_district_outcome = 1 if ces04_fed03 == 35008 
replace CA04_district_outcome = 1 if ces04_fed03 == 35009 
replace CA04_district_outcome = 1 if ces04_fed03 == 35010 
replace CA04_district_outcome = 2 if ces04_fed03 == 35011 
replace CA04_district_outcome = 2 if ces04_fed03 == 35012 
replace CA04_district_outcome = 1 if ces04_fed03 == 35013 
replace CA04_district_outcome = 2 if ces04_fed03 == 35014 
replace CA04_district_outcome = 1 if ces04_fed03 == 35015 
replace CA04_district_outcome = 1 if ces04_fed03 == 35016 
replace CA04_district_outcome = 1 if ces04_fed03 == 35017 
replace CA04_district_outcome = 2 if ces04_fed03 == 35018 
replace CA04_district_outcome = 1 if ces04_fed03 == 35019 
replace CA04_district_outcome = 2 if ces04_fed03 == 35020 
replace CA04_district_outcome = 2 if ces04_fed03 == 35021 
replace CA04_district_outcome = 1 if ces04_fed03 == 35022 
replace CA04_district_outcome = 1 if ces04_fed03 == 35023 
replace CA04_district_outcome = 1 if ces04_fed03 == 35024 
replace CA04_district_outcome = 1 if ces04_fed03 == 35025 
replace CA04_district_outcome = 2 if ces04_fed03 == 35026 
replace CA04_district_outcome = 1 if ces04_fed03 == 35027 
replace CA04_district_outcome = 2 if ces04_fed03 == 35028 
replace CA04_district_outcome = 2 if ces04_fed03 == 35029 
replace CA04_district_outcome = 1 if ces04_fed03 == 35030 
replace CA04_district_outcome = 3 if ces04_fed03 == 35031 
replace CA04_district_outcome = 1 if ces04_fed03 == 35032 
replace CA04_district_outcome = 1 if ces04_fed03 == 35033 
replace CA04_district_outcome = 1 if ces04_fed03 == 35034 
replace CA04_district_outcome = 1 if ces04_fed03 == 35035 
replace CA04_district_outcome = 1 if ces04_fed03 == 35036 
replace CA04_district_outcome = 1 if ces04_fed03 == 35037 
replace CA04_district_outcome = 1 if ces04_fed03 == 35038 
replace CA04_district_outcome = 1 if ces04_fed03 == 35039 
replace CA04_district_outcome = 2 if ces04_fed03 == 35040 
replace CA04_district_outcome = 2 if ces04_fed03 == 35041 
replace CA04_district_outcome = 1 if ces04_fed03 == 35042 
replace CA04_district_outcome = 1 if ces04_fed03 == 35043 
replace CA04_district_outcome = 1 if ces04_fed03 == 35044 
replace CA04_district_outcome = 1 if ces04_fed03 == 35045 
replace CA04_district_outcome = 1 if ces04_fed03 == 35046 
replace CA04_district_outcome = 1 if ces04_fed03 == 35047 
replace CA04_district_outcome = 1 if ces04_fed03 == 35048 
replace CA04_district_outcome = 1 if ces04_fed03 == 35049 
replace CA04_district_outcome = 1 if ces04_fed03 == 35050 
replace CA04_district_outcome = 1 if ces04_fed03 == 35051 
replace CA04_district_outcome = 2 if ces04_fed03 == 35052 
replace CA04_district_outcome = 2 if ces04_fed03 == 35053 
replace CA04_district_outcome = 2 if ces04_fed03 == 35054 
replace CA04_district_outcome = 2 if ces04_fed03 == 35055 
replace CA04_district_outcome = 1 if ces04_fed03 == 35056 
replace CA04_district_outcome = 1 if ces04_fed03 == 35057 
replace CA04_district_outcome = 1 if ces04_fed03 == 35058 
replace CA04_district_outcome = 1 if ces04_fed03 == 35059 
replace CA04_district_outcome = 1 if ces04_fed03 == 35060 
replace CA04_district_outcome = 2 if ces04_fed03 == 35061 
replace CA04_district_outcome = 3 if ces04_fed03 == 35062 
replace CA04_district_outcome = 1 if ces04_fed03 == 35063 
replace CA04_district_outcome = 1 if ces04_fed03 == 35064 
replace CA04_district_outcome = 1 if ces04_fed03 == 35065 
replace CA04_district_outcome = 1 if ces04_fed03 == 35066 
replace CA04_district_outcome = 2 if ces04_fed03 == 35067 
replace CA04_district_outcome = 1 if ces04_fed03 == 35068 
replace CA04_district_outcome = 1 if ces04_fed03 == 35069 
replace CA04_district_outcome = 2 if ces04_fed03 == 35070 
replace CA04_district_outcome = 1 if ces04_fed03 == 35071 
replace CA04_district_outcome = 1 if ces04_fed03 == 35072 
replace CA04_district_outcome = 2 if ces04_fed03 == 35073 
replace CA04_district_outcome = 2 if ces04_fed03 == 35074 
replace CA04_district_outcome = 1 if ces04_fed03 == 35075 
replace CA04_district_outcome = 1 if ces04_fed03 == 35076 
replace CA04_district_outcome = 1 if ces04_fed03 == 35077 
replace CA04_district_outcome = 1 if ces04_fed03 == 35078 
replace CA04_district_outcome = 3 if ces04_fed03 == 35079 
replace CA04_district_outcome = 1 if ces04_fed03 == 35080 
replace CA04_district_outcome = 1 if ces04_fed03 == 35081 
replace CA04_district_outcome = 1 if ces04_fed03 == 35082 
replace CA04_district_outcome = 1 if ces04_fed03 == 35083 
replace CA04_district_outcome = 1 if ces04_fed03 == 35084 
replace CA04_district_outcome = 2 if ces04_fed03 == 35085 
replace CA04_district_outcome = 1 if ces04_fed03 == 35086 
replace CA04_district_outcome = 2 if ces04_fed03 == 35087 
replace CA04_district_outcome = 1 if ces04_fed03 == 35088 
replace CA04_district_outcome = 1 if ces04_fed03 == 35089 
replace CA04_district_outcome = 1 if ces04_fed03 == 35090 
replace CA04_district_outcome = 1 if ces04_fed03 == 35091 
replace CA04_district_outcome = 3 if ces04_fed03 == 35092 
replace CA04_district_outcome = 1 if ces04_fed03 == 35093 
replace CA04_district_outcome = 3 if ces04_fed03 == 35094 
replace CA04_district_outcome = 1 if ces04_fed03 == 35095 
replace CA04_district_outcome = 1 if ces04_fed03 == 35096 
replace CA04_district_outcome = 1 if ces04_fed03 == 35097 
replace CA04_district_outcome = 2 if ces04_fed03 == 35098 
replace CA04_district_outcome = 1 if ces04_fed03 == 35099 
replace CA04_district_outcome = 1 if ces04_fed03 == 35100 
replace CA04_district_outcome = 3 if ces04_fed03 == 35101 
replace CA04_district_outcome = 3 if ces04_fed03 == 35102 
replace CA04_district_outcome = 1 if ces04_fed03 == 35103 
replace CA04_district_outcome = 2 if ces04_fed03 == 35104 
replace CA04_district_outcome = 1 if ces04_fed03 == 35105 
replace CA04_district_outcome = 1 if ces04_fed03 == 35106 
replace CA04_district_outcome = 2 if ces04_fed03 == 46001 
replace CA04_district_outcome = 2 if ces04_fed03 == 46002 
replace CA04_district_outcome = 3 if ces04_fed03 == 46003 
replace CA04_district_outcome = 2 if ces04_fed03 == 46004 
replace CA04_district_outcome = 3 if ces04_fed03 == 46005 
replace CA04_district_outcome = 2 if ces04_fed03 == 46006 
replace CA04_district_outcome = 2 if ces04_fed03 == 46007 
replace CA04_district_outcome = 2 if ces04_fed03 == 46008 
replace CA04_district_outcome = 1 if ces04_fed03 == 46009 
replace CA04_district_outcome = 2 if ces04_fed03 == 46010 
replace CA04_district_outcome = 3 if ces04_fed03 == 46011 
replace CA04_district_outcome = 3 if ces04_fed03 == 46012 
replace CA04_district_outcome = 1 if ces04_fed03 == 46013 
replace CA04_district_outcome = 1 if ces04_fed03 == 46014 
replace CA04_district_outcome = 2 if ces04_fed03 == 47001 
replace CA04_district_outcome = 2 if ces04_fed03 == 47002 
replace CA04_district_outcome = 2 if ces04_fed03 == 47003 
replace CA04_district_outcome = 2 if ces04_fed03 == 47004 
replace CA04_district_outcome = 2 if ces04_fed03 == 47005 
replace CA04_district_outcome = 2 if ces04_fed03 == 47006 
replace CA04_district_outcome = 2 if ces04_fed03 == 47007 
replace CA04_district_outcome = 2 if ces04_fed03 == 47008 
replace CA04_district_outcome = 2 if ces04_fed03 == 47009 
replace CA04_district_outcome = 2 if ces04_fed03 == 47010 
replace CA04_district_outcome = 2 if ces04_fed03 == 47011 
replace CA04_district_outcome = 2 if ces04_fed03 == 47012 
replace CA04_district_outcome = 1 if ces04_fed03 == 47013 
replace CA04_district_outcome = 2 if ces04_fed03 == 47014 
replace CA04_district_outcome = 2 if ces04_fed03 == 48001 
replace CA04_district_outcome = 2 if ces04_fed03 == 48002 
replace CA04_district_outcome = 2 if ces04_fed03 == 48003 
replace CA04_district_outcome = 2 if ces04_fed03 == 48004 
replace CA04_district_outcome = 2 if ces04_fed03 == 48005 
replace CA04_district_outcome = 2 if ces04_fed03 == 48006 
replace CA04_district_outcome = 2 if ces04_fed03 == 48007 
replace CA04_district_outcome = 2 if ces04_fed03 == 48008 
replace CA04_district_outcome = 2 if ces04_fed03 == 48009 
replace CA04_district_outcome = 2 if ces04_fed03 == 48010 
replace CA04_district_outcome = 1 if ces04_fed03 == 48011 
replace CA04_district_outcome = 1 if ces04_fed03 == 48012 
replace CA04_district_outcome = 2 if ces04_fed03 == 48013 
replace CA04_district_outcome = 2 if ces04_fed03 == 48014 
replace CA04_district_outcome = 2 if ces04_fed03 == 48015 
replace CA04_district_outcome = 2 if ces04_fed03 == 48016 
replace CA04_district_outcome = 2 if ces04_fed03 == 48017 
replace CA04_district_outcome = 2 if ces04_fed03 == 48018 
replace CA04_district_outcome = 2 if ces04_fed03 == 48019 
replace CA04_district_outcome = 2 if ces04_fed03 == 48020 
replace CA04_district_outcome = 2 if ces04_fed03 == 48021 
replace CA04_district_outcome = 2 if ces04_fed03 == 48022 
replace CA04_district_outcome = 2 if ces04_fed03 == 48023 
replace CA04_district_outcome = 2 if ces04_fed03 == 48024 
replace CA04_district_outcome = 2 if ces04_fed03 == 48025 
replace CA04_district_outcome = 2 if ces04_fed03 == 48026 
replace CA04_district_outcome = 2 if ces04_fed03 == 48027 
replace CA04_district_outcome = 2 if ces04_fed03 == 48028 
replace CA04_district_outcome = 2 if ces04_fed03 == 59001 
replace CA04_district_outcome = 3 if ces04_fed03 == 59002 
replace CA04_district_outcome = 3 if ces04_fed03 == 59003 
replace CA04_district_outcome = 2 if ces04_fed03 == 59004 
replace CA04_district_outcome = 2 if ces04_fed03 == 59005 
replace CA04_district_outcome = 2 if ces04_fed03 == 59006 
replace CA04_district_outcome = 2 if ces04_fed03 == 59007 
replace CA04_district_outcome = 1 if ces04_fed03 == 59008 
replace CA04_district_outcome = 2 if ces04_fed03 == 59009 
replace CA04_district_outcome = 2 if ces04_fed03 == 59010 
replace CA04_district_outcome = 2 if ces04_fed03 == 59011 
replace CA04_district_outcome = 2 if ces04_fed03 == 59012 
replace CA04_district_outcome = 2 if ces04_fed03 == 59013 
replace CA04_district_outcome = 2 if ces04_fed03 == 59014 
replace CA04_district_outcome = 3 if ces04_fed03 == 59015 
replace CA04_district_outcome = 2 if ces04_fed03 == 59016 
replace CA04_district_outcome = 2 if ces04_fed03 == 59017 
replace CA04_district_outcome = 2 if ces04_fed03 == 59018 
replace CA04_district_outcome = 1 if ces04_fed03 == 59019 
replace CA04_district_outcome = 2 if ces04_fed03 == 59020 
replace CA04_district_outcome = 2 if ces04_fed03 == 59021 
replace CA04_district_outcome = 2 if ces04_fed03 == 59022 
replace CA04_district_outcome = 1 if ces04_fed03 == 59023 
replace CA04_district_outcome = 2 if ces04_fed03 == 59024 
replace CA04_district_outcome = 3 if ces04_fed03 == 59025 
replace CA04_district_outcome = 2 if ces04_fed03 == 59026 
replace CA04_district_outcome = 2 if ces04_fed03 == 59027 
replace CA04_district_outcome = 88 if ces04_fed03 == 59028 
replace CA04_district_outcome = 1 if ces04_fed03 == 59029 
replace CA04_district_outcome = 3 if ces04_fed03 == 59030 
replace CA04_district_outcome = 2 if ces04_fed03 == 59031 
replace CA04_district_outcome = 1 if ces04_fed03 == 59032 
replace CA04_district_outcome = 1 if ces04_fed03 == 59033 
replace CA04_district_outcome = 1 if ces04_fed03 == 59034 
replace CA04_district_outcome = 1 if ces04_fed03 == 59035 
replace CA04_district_outcome = 2 if ces04_fed03 == 59036 
replace CA04_district_outcome = 1 if ces04_fed03 == 60001 
replace CA04_district_outcome = 1 if ces04_fed03 == 61001 
replace CA04_district_outcome = 1 if ces04_fed03 == 62001 


********************************************
** COMPETITIVENESS: 2004 FEDERAL ELECTION **
********************************************

* Margin of victory

gen CA04_margin = .

replace CA04_margin = 29.03 if ces04_fed03 == 10001 
replace CA04_margin = 6.59 if ces04_fed03 == 10002 
replace CA04_margin = 39.61 if ces04_fed03 == 10003 
replace CA04_margin = 46.46 if ces04_fed03 == 10004 
replace CA04_margin = 13.54 if ces04_fed03 == 10005 
replace CA04_margin = 4.75 if ces04_fed03 == 10006 
replace CA04_margin = 4.31 if ces04_fed03 == 10007 
replace CA04_margin = 20.14 if ces04_fed03 == 11001 
replace CA04_margin = 21.81 if ces04_fed03 == 11002 
replace CA04_margin = 26.35 if ces04_fed03 == 11003 
replace CA04_margin = 19.4 if ces04_fed03 == 11004 
replace CA04_margin = 28.94 if ces04_fed03 == 12001 
replace CA04_margin = 15.61 if ces04_fed03 == 12002 
replace CA04_margin = 9.57 if ces04_fed03 == 12003 
replace CA04_margin = 2.44 if ces04_fed03 == 12004 
replace CA04_margin = 19.55 if ces04_fed03 == 12005 
replace CA04_margin = 16.49 if ces04_fed03 == 12006 
replace CA04_margin = 24.00 if ces04_fed03 == 12007 
replace CA04_margin = 17.11 if ces04_fed03 == 12008 
replace CA04_margin = 5.82 if ces04_fed03 == 12009 
replace CA04_margin = 24.42 if ces04_fed03 == 12010 
replace CA04_margin = 9.61 if ces04_fed03 == 12011 
replace CA04_margin = 21.26 if ces04_fed03 == 13001 
replace CA04_margin = 25.09 if ces04_fed03 == 13002 
replace CA04_margin = 13.28 if ces04_fed03 == 13003 
replace CA04_margin = 10.05 if ces04_fed03 == 13004 
replace CA04_margin = 17.07 if ces04_fed03 == 13005 
replace CA04_margin = 19.05 if ces04_fed03 == 13006 
replace CA04_margin = 35.81 if ces04_fed03 == 13007 
replace CA04_margin = 21.55 if ces04_fed03 == 13008 
replace CA04_margin = 9.66 if ces04_fed03 == 13009 
replace CA04_margin = 8.64 if ces04_fed03 == 13010 
replace CA04_margin = 26.68 if ces04_fed03 == 24001 
replace CA04_margin = 2.51 if ces04_fed03 == 24002 
replace CA04_margin = 9.61 if ces04_fed03 == 24003 
replace CA04_margin = 30.53 if ces04_fed03 == 24004 
replace CA04_margin = 5.12 if ces04_fed03 == 24005 
replace CA04_margin = 16.05 if ces04_fed03 == 24006 
replace CA04_margin = 24.02 if ces04_fed03 == 24007 
replace CA04_margin = 37.11 if ces04_fed03 == 24008 
replace CA04_margin = 12.27 if ces04_fed03 == 24009 
replace CA04_margin = 2.42 if ces04_fed03 == 24010 
replace CA04_margin = 4.86 if ces04_fed03 == 24011 
replace CA04_margin = 38.1 if ces04_fed03 == 24012 
replace CA04_margin = 25.87 if ces04_fed03 == 24013 
replace CA04_margin = 40.33 if ces04_fed03 == 24014 
replace CA04_margin = 27.24 if ces04_fed03 == 24015 
replace CA04_margin = 1.9 if ces04_fed03 == 24016 
replace CA04_margin = 10.73 if ces04_fed03 == 24017 
replace CA04_margin = 33.48 if ces04_fed03 == 24018 
replace CA04_margin = 23.02 if ces04_fed03 == 24019 
replace CA04_margin = 1.82 if ces04_fed03 == 24020 
replace CA04_margin = 34.49 if ces04_fed03 == 24021 
replace CA04_margin = 5.73 if ces04_fed03 == 24022 
replace CA04_margin = 9.38 if ces04_fed03 == 24023 
replace CA04_margin = 0.16 if ces04_fed03 == 24024 
replace CA04_margin = 40.72 if ces04_fed03 == 24025 
replace CA04_margin = 25.81 if ces04_fed03 == 24026 
replace CA04_margin = 51.81 if ces04_fed03 == 24027 
replace CA04_margin = 43.54 if ces04_fed03 == 24028 
replace CA04_margin = 25.87 if ces04_fed03 == 24029 
replace CA04_margin = 28.95 if ces04_fed03 == 24030 
replace CA04_margin = 42.39 if ces04_fed03 == 24031 
replace CA04_margin = 13.91 if ces04_fed03 == 24032 
replace CA04_margin = 10.75 if ces04_fed03 == 24033 
replace CA04_margin = 16.72 if ces04_fed03 == 24034 
replace CA04_margin = 35.38 if ces04_fed03 == 24035 
replace CA04_margin = 21.85 if ces04_fed03 == 24036 
replace CA04_margin = 9.08 if ces04_fed03 == 24037 
replace CA04_margin = 7.31 if ces04_fed03 == 24038 
replace CA04_margin = 33.63 if ces04_fed03 == 24039 
replace CA04_margin = 31.16 if ces04_fed03 == 24040 
replace CA04_margin = 25.97 if ces04_fed03 == 24041 
replace CA04_margin = 8.09 if ces04_fed03 == 24042 
replace CA04_margin = 54.84 if ces04_fed03 == 24043 
replace CA04_margin = 67.05 if ces04_fed03 == 24044 
replace CA04_margin = 31.21 if ces04_fed03 == 24045 
replace CA04_margin = 2.06 if ces04_fed03 == 24046 
replace CA04_margin = 7.69 if ces04_fed03 == 24047 
replace CA04_margin = 1.14 if ces04_fed03 == 24048 
replace CA04_margin = 47.62 if ces04_fed03 == 24049 
replace CA04_margin = 9.17 if ces04_fed03 == 24050 
replace CA04_margin = 15.35 if ces04_fed03 == 24051 
replace CA04_margin = 23.66 if ces04_fed03 == 24052 
replace CA04_margin = 51.81 if ces04_fed03 == 24053 
replace CA04_margin = 41.99 if ces04_fed03 == 24054 
replace CA04_margin = 28.4 if ces04_fed03 == 24055 
replace CA04_margin = 33.86 if ces04_fed03 == 24056 
replace CA04_margin = 37.21 if ces04_fed03 == 24057 
replace CA04_margin = 27.52 if ces04_fed03 == 24058 
replace CA04_margin = 44.73 if ces04_fed03 == 24059 
replace CA04_margin = 36.22 if ces04_fed03 == 24060 
replace CA04_margin = 38.9 if ces04_fed03 == 24061 
replace CA04_margin = 24.74 if ces04_fed03 == 24062 
replace CA04_margin = 40.28 if ces04_fed03 == 24063 
replace CA04_margin = 34.16 if ces04_fed03 == 24064 
replace CA04_margin = 11.91 if ces04_fed03 == 24065 
replace CA04_margin = 49.56 if ces04_fed03 == 24066 
replace CA04_margin = 42.05 if ces04_fed03 == 24067 
replace CA04_margin = 24.74 if ces04_fed03 == 24068 
replace CA04_margin = 6.88 if ces04_fed03 == 24069 
replace CA04_margin = 27.73 if ces04_fed03 == 24070 
replace CA04_margin = 48.43 if ces04_fed03 == 24071 
replace CA04_margin = 29.15 if ces04_fed03 == 24072 
replace CA04_margin = 5.49 if ces04_fed03 == 24073 
replace CA04_margin = 47.42 if ces04_fed03 == 24074 
replace CA04_margin = 41.03 if ces04_fed03 == 24075 
replace CA04_margin = 16.14 if ces04_fed03 == 35001 
replace CA04_margin = 9.25 if ces04_fed03 == 35002 
replace CA04_margin = 5.06 if ces04_fed03 == 35003 
replace CA04_margin = 2.6 if ces04_fed03 == 35004 
replace CA04_margin = 15.64 if ces04_fed03 == 35005 
replace CA04_margin = 18.95 if ces04_fed03 == 35006 
replace CA04_margin = 20.2 if ces04_fed03 == 35007 
replace CA04_margin = 5.3 if ces04_fed03 == 35008 
replace CA04_margin = 4.95 if ces04_fed03 == 35009 
replace CA04_margin = 6.61 if ces04_fed03 == 35010 
replace CA04_margin = 0.44 if ces04_fed03 == 35011 
replace CA04_margin = 16.05 if ces04_fed03 == 35012 
replace CA04_margin = 0.93 if ces04_fed03 == 35013 
replace CA04_margin = 2.47 if ces04_fed03 == 35014 
replace CA04_margin = 16.56 if ces04_fed03 == 35015 
replace CA04_margin = 26.63 if ces04_fed03 == 35016 
replace CA04_margin = 31.48 if ces04_fed03 == 35017 
replace CA04_margin = 3.81 if ces04_fed03 == 35018 
replace CA04_margin = 35.19 if ces04_fed03 == 35019 
replace CA04_margin = 9.64 if ces04_fed03 == 35020 
replace CA04_margin = 1.62 if ces04_fed03 == 35021 
replace CA04_margin = 29.89 if ces04_fed03 == 35022 
replace CA04_margin = 19.66 if ces04_fed03 == 35023 
replace CA04_margin = 44.64 if ces04_fed03 == 35024 
replace CA04_margin = 10.39 if ces04_fed03 == 35025 
replace CA04_margin = 9.21 if ces04_fed03 == 35026 
replace CA04_margin = 18.5 if ces04_fed03 == 35027 
replace CA04_margin = 3.31 if ces04_fed03 == 35028 
replace CA04_margin = 9.72 if ces04_fed03 == 35029 
replace CA04_margin = 10.00 if ces04_fed03 == 35030 
replace CA04_margin = 12.11 if ces04_fed03 == 35031 
replace CA04_margin = 1.9 if ces04_fed03 == 35032 
replace CA04_margin = 1.87 if ces04_fed03 == 35033 
replace CA04_margin = 18.73 if ces04_fed03 == 35034 
replace CA04_margin = 4.17 if ces04_fed03 == 35035 
replace CA04_margin = 29.33 if ces04_fed03 == 35036 
replace CA04_margin = 19.62 if ces04_fed03 == 35037 
replace CA04_margin = 6.92 if ces04_fed03 == 35038 
replace CA04_margin = 18.65 if ces04_fed03 == 35039 
replace CA04_margin = 17.8 if ces04_fed03 == 35040 
replace CA04_margin = 17.53 if ces04_fed03 == 35041 
replace CA04_margin = 7.67 if ces04_fed03 == 35042 
replace CA04_margin = 15.64 if ces04_fed03 == 35043 
replace CA04_margin = 14.02 if ces04_fed03 == 35044 
replace CA04_margin = 43.82 if ces04_fed03 == 35045 
replace CA04_margin = 0.34 if ces04_fed03 == 35046 
replace CA04_margin = 33.07 if ces04_fed03 == 35047 
replace CA04_margin = 30.67 if ces04_fed03 == 35048 
replace CA04_margin = 22.42 if ces04_fed03 == 35049 
replace CA04_margin = 18.05 if ces04_fed03 == 35050 
replace CA04_margin = 18.83 if ces04_fed03 == 35051 
replace CA04_margin = 5.61 if ces04_fed03 == 35052 
replace CA04_margin = 1.34 if ces04_fed03 == 35053 
replace CA04_margin = 2.22 if ces04_fed03 == 35054 
replace CA04_margin = 1.28 if ces04_fed03 == 35055 
replace CA04_margin = 7.91 if ces04_fed03 == 35056 
replace CA04_margin = 5.22 if ces04_fed03 == 35057 
replace CA04_margin = 0.54 if ces04_fed03 == 35058 
replace CA04_margin = 18.21 if ces04_fed03 == 35059 
replace CA04_margin = 16.66 if ces04_fed03 == 35060 
replace CA04_margin = 0.97 if ces04_fed03 == 35061 
replace CA04_margin = 9.98 if ces04_fed03 == 35062 
replace CA04_margin = 4.65 if ces04_fed03 == 35063 
replace CA04_margin = 9.00 if ces04_fed03 == 35064 
replace CA04_margin = 24.98 if ces04_fed03 == 35065 
replace CA04_margin = 2.41 if ces04_fed03 == 35066 
replace CA04_margin = 14.37 if ces04_fed03 == 35067 
replace CA04_margin = 7.52 if ces04_fed03 == 35068 
replace CA04_margin = 7.51 if ces04_fed03 == 35069 
replace CA04_margin = 8.55 if ces04_fed03 == 35070 
replace CA04_margin = 11.63 if ces04_fed03 == 35071 
replace CA04_margin = 28.99 if ces04_fed03 == 35072 
replace CA04_margin = 4.79 if ces04_fed03 == 35073 
replace CA04_margin = 25.43 if ces04_fed03 == 35074 
replace CA04_margin = 33.6 if ces04_fed03 == 35075 
replace CA04_margin = 5.73 if ces04_fed03 == 35076 
replace CA04_margin = 38.01 if ces04_fed03 == 35077 
replace CA04_margin = 11.43 if ces04_fed03 == 35078 
replace CA04_margin = 1.74 if ces04_fed03 == 35079 
replace CA04_margin = 43.09 if ces04_fed03 == 35080 
replace CA04_margin = 33.39 if ces04_fed03 == 35081 
replace CA04_margin = 34.8 if ces04_fed03 == 35082 
replace CA04_margin = 40.05 if ces04_fed03 == 35083 
replace CA04_margin = 25.68 if ces04_fed03 == 35084 
replace CA04_margin = 0.18 if ces04_fed03 == 35085 
replace CA04_margin = 5.67 if ces04_fed03 == 35086 
replace CA04_margin = 8.07 if ces04_fed03 == 35087 
replace CA04_margin = 14.33 if ces04_fed03 == 35088 
replace CA04_margin = 20.12 if ces04_fed03 == 35089 
replace CA04_margin = 9.67 if ces04_fed03 == 35090 
replace CA04_margin = 13.73 if ces04_fed03 == 35091 
replace CA04_margin = 1.8 if ces04_fed03 == 35092 
replace CA04_margin = 32.78 if ces04_fed03 == 35093 
replace CA04_margin = 5.00 if ces04_fed03 == 35094 
replace CA04_margin = 1.51 if ces04_fed03 == 35095 
replace CA04_margin = 39.28 if ces04_fed03 == 35096 
replace CA04_margin = 10.13 if ces04_fed03 == 35097 
replace CA04_margin = 4.6 if ces04_fed03 == 35098 
replace CA04_margin = 8.98 if ces04_fed03 == 35099 
replace CA04_margin = 38.28 if ces04_fed03 == 35100 
replace CA04_margin = 7.97 if ces04_fed03 == 35101 
replace CA04_margin = 14.65 if ces04_fed03 == 35102 
replace CA04_margin = 28.52 if ces04_fed03 == 35103 
replace CA04_margin = 9.7 if ces04_fed03 == 35104 
replace CA04_margin = 38.62 if ces04_fed03 == 35105 
replace CA04_margin = 49.45 if ces04_fed03 == 35106 
replace CA04_margin = 27.51 if ces04_fed03 == 46001 
replace CA04_margin = 1.74 if ces04_fed03 == 46002 
replace CA04_margin = 5.09 if ces04_fed03 == 46003 
replace CA04_margin = 31.98 if ces04_fed03 == 46004 
replace CA04_margin = 25.88 if ces04_fed03 == 46005 
replace CA04_margin = 0.76 if ces04_fed03 == 46006 
replace CA04_margin = 48.19 if ces04_fed03 == 46007 
replace CA04_margin = 38.1 if ces04_fed03 == 46008 
replace CA04_margin = 15.63 if ces04_fed03 == 46009 
replace CA04_margin = 20.72 if ces04_fed03 == 46010 
replace CA04_margin = 10.7 if ces04_fed03 == 46011 
replace CA04_margin = 11.61 if ces04_fed03 == 46012 
replace CA04_margin = 17.31 if ces04_fed03 == 46013 
replace CA04_margin = 19.58 if ces04_fed03 == 46014 
replace CA04_margin = 38.00 if ces04_fed03 == 47001 
replace CA04_margin = 10.08 if ces04_fed03 == 47002 
replace CA04_margin = 7.52 if ces04_fed03 == 47003 
replace CA04_margin = 41.96 if ces04_fed03 == 47004 
replace CA04_margin = 0.37 if ces04_fed03 == 47005 
replace CA04_margin = 22.13 if ces04_fed03 == 47006 
replace CA04_margin = 0.39 if ces04_fed03 == 47007 
replace CA04_margin = 3.07 if ces04_fed03 == 47008 
replace CA04_margin = 1.18 if ces04_fed03 == 47009 
replace CA04_margin = 8.6 if ces04_fed03 == 47010 
replace CA04_margin = 14.06 if ces04_fed03 == 47011 
replace CA04_margin = 9.48 if ces04_fed03 == 47012 
replace CA04_margin = 32.96 if ces04_fed03 == 47013 
replace CA04_margin = 44.35 if ces04_fed03 == 47014 
replace CA04_margin = 36.25 if ces04_fed03 == 48001 
replace CA04_margin = 39.85 if ces04_fed03 == 48002 
replace CA04_margin = 32.83 if ces04_fed03 == 48003 
replace CA04_margin = 37.62 if ces04_fed03 == 48004 
replace CA04_margin = 41.49 if ces04_fed03 == 48005 
replace CA04_margin = 21.27 if ces04_fed03 == 48006 
replace CA04_margin = 54.64 if ces04_fed03 == 48007 
replace CA04_margin = 49.96 if ces04_fed03 == 48008 
replace CA04_margin = 26.63 if ces04_fed03 == 48009 
replace CA04_margin = 72.51 if ces04_fed03 == 48010 
replace CA04_margin = 0.33 if ces04_fed03 == 48011 
replace CA04_margin = 1.36 if ces04_fed03 == 48012 
replace CA04_margin = 13.59 if ces04_fed03 == 48013 
replace CA04_margin = 25.73 if ces04_fed03 == 48014 
replace CA04_margin = 33.5 if ces04_fed03 == 48015 
replace CA04_margin = 33.38 if ces04_fed03 == 48016 
replace CA04_margin = 34.83 if ces04_fed03 == 48017 
replace CA04_margin = 10.39 if ces04_fed03 == 48018 
replace CA04_margin = 41.06 if ces04_fed03 == 48019 
replace CA04_margin = 62.67 if ces04_fed03 == 48020 
replace CA04_margin = 65.24 if ces04_fed03 == 48021 
replace CA04_margin = 46.16 if ces04_fed03 == 48022 
replace CA04_margin = 62.98 if ces04_fed03 == 48023 
replace CA04_margin = 61.81 if ces04_fed03 == 48024 
replace CA04_margin = 47.54 if ces04_fed03 == 48025 
replace CA04_margin = 61.73 if ces04_fed03 == 48026 
replace CA04_margin = 57.96 if ces04_fed03 == 48027 
replace CA04_margin = 57.11 if ces04_fed03 == 48028 
replace CA04_margin = 41.42 if ces04_fed03 == 59001 
replace CA04_margin = 2.06 if ces04_fed03 == 59002 
replace CA04_margin = 0.79 if ces04_fed03 == 59003 
replace CA04_margin = 20.23 if ces04_fed03 == 59004 
replace CA04_margin = 33.09 if ces04_fed03 == 59005 
replace CA04_margin = 12.4 if ces04_fed03 == 59006 
replace CA04_margin = 5.83 if ces04_fed03 == 59007 
replace CA04_margin = 4.68 if ces04_fed03 == 59008 
replace CA04_margin = 6.33 if ces04_fed03 == 59009 
replace CA04_margin = 12.09 if ces04_fed03 == 59010 
replace CA04_margin = 21.5 if ces04_fed03 == 59011 
replace CA04_margin = 28.2 if ces04_fed03 == 59012 
replace CA04_margin = 22.96 if ces04_fed03 == 59013 
replace CA04_margin = 6.76 if ces04_fed03 == 59014 
replace CA04_margin = 10.93 if ces04_fed03 == 59015 
replace CA04_margin = 1.27 if ces04_fed03 == 59016 
replace CA04_margin = 0.23 if ces04_fed03 == 59017 
replace CA04_margin = 22.19 if ces04_fed03 == 59018 
replace CA04_margin = 3.67 if ces04_fed03 == 59019 
replace CA04_margin = 26.74 if ces04_fed03 == 59020 
replace CA04_margin = 13.64 if ces04_fed03 == 59021 
replace CA04_margin = 38.01 if ces04_fed03 == 59022 
replace CA04_margin = 9.15 if ces04_fed03 == 59023 
replace CA04_margin = 7.79 if ces04_fed03 == 59024 
replace CA04_margin = 3.44 if ces04_fed03 == 59025 
replace CA04_margin = 1.47 if ces04_fed03 == 59026 
replace CA04_margin = 5.9 if ces04_fed03 == 59027 
replace CA04_margin = 19.67 if ces04_fed03 == 59028 
replace CA04_margin = 8.01 if ces04_fed03 == 59029 
replace CA04_margin = 30.53 if ces04_fed03 == 59030 
replace CA04_margin = 0.91 if ces04_fed03 == 59031 
replace CA04_margin = 3.16 if ces04_fed03 == 59032 
replace CA04_margin = 26.12 if ces04_fed03 == 59033 
replace CA04_margin = 19.01 if ces04_fed03 == 59034 
replace CA04_margin = 3.96 if ces04_fed03 == 59035 
replace CA04_margin = 2.79 if ces04_fed03 == 59036 
replace CA04_margin = 20.02 if ces04_fed03 == 60001 
replace CA04_margin = 0.39 if ces04_fed03 == 61001 
replace CA04_margin = 35.55 if ces04_fed03 == 62001 

* Effective number of electoral parties

gen CA04_enep = .

replace CA04_enep = 2.280466 if ces04_fed03 == 10001 
replace CA04_enep = 2.426155 if ces04_fed03 == 10002 
replace CA04_enep = 2.166876 if ces04_fed03 == 10003 
replace CA04_enep = 2.311947 if ces04_fed03 == 10004 
replace CA04_enep = 2.757499 if ces04_fed03 == 10005 
replace CA04_enep = 2.896247 if ces04_fed03 == 10006 
replace CA04_enep = 2.964414 if ces04_fed03 == 10007 
replace CA04_enep = 2.458345 if ces04_fed03 == 11001 
replace CA04_enep = 2.814929 if ces04_fed03 == 11002 
replace CA04_enep = 2.457716 if ces04_fed03 == 11003 
replace CA04_enep = 2.576046 if ces04_fed03 == 11004 
replace CA04_enep = 2.602502 if ces04_fed03 == 12001 
replace CA04_enep = 2.993131 if ces04_fed03 == 12002 
replace CA04_enep = 3.046589 if ces04_fed03 == 12003 
replace CA04_enep = 2.863512 if ces04_fed03 == 12004 
replace CA04_enep = 2.866177 if ces04_fed03 == 12005 
replace CA04_enep = 2.934382 if ces04_fed03 == 12006 
replace CA04_enep = 2.763026 if ces04_fed03 == 12007 
replace CA04_enep = 2.957321 if ces04_fed03 == 12008 
replace CA04_enep = 3.180052 if ces04_fed03 == 12009 
replace CA04_enep = 2.670462 if ces04_fed03 == 12010 
replace CA04_enep = 2.971262 if ces04_fed03 == 12011 
replace CA04_enep = 2.438156 if ces04_fed03 == 13001 
replace CA04_enep = 2.587717 if ces04_fed03 == 13002 
replace CA04_enep = 2.764067 if ces04_fed03 == 13003 
replace CA04_enep = 2.864586 if ces04_fed03 == 13004 
replace CA04_enep = 2.988472 if ces04_fed03 == 13005 
replace CA04_enep = 2.8469 if ces04_fed03 == 13006 
replace CA04_enep = 2.355234 if ces04_fed03 == 13007 
replace CA04_enep = 2.528425 if ces04_fed03 == 13008 
replace CA04_enep = 2.964408 if ces04_fed03 == 13009 
replace CA04_enep = 2.513009 if ces04_fed03 == 13010 
replace CA04_enep = 2.307989 if ces04_fed03 == 24001 
replace CA04_enep = 2.709902 if ces04_fed03 == 24002 
replace CA04_enep = 2.48113 if ces04_fed03 == 24003 
replace CA04_enep = 2.437979 if ces04_fed03 == 24004 
replace CA04_enep = 2.999908 if ces04_fed03 == 24005 
replace CA04_enep = 2.589085 if ces04_fed03 == 24006 
replace CA04_enep = 2.935405 if ces04_fed03 == 24007 
replace CA04_enep = 2.351378 if ces04_fed03 == 24008 
replace CA04_enep = 2.514814 if ces04_fed03 == 24009 
replace CA04_enep = 2.86244 if ces04_fed03 == 24010 
replace CA04_enep = 2.596124 if ces04_fed03 == 24011 
replace CA04_enep = 2.316523 if ces04_fed03 == 24012 
replace CA04_enep = 2.783048 if ces04_fed03 == 24013 
replace CA04_enep = 2.320195 if ces04_fed03 == 24014 
replace CA04_enep = 2.358349 if ces04_fed03 == 24015 
replace CA04_enep = 2.507876 if ces04_fed03 == 24016 
replace CA04_enep = 2.771635 if ces04_fed03 == 24017 
replace CA04_enep = 2.510196 if ces04_fed03 == 24018 
replace CA04_enep = 2.367487 if ces04_fed03 == 24019 
replace CA04_enep = 2.862012 if ces04_fed03 == 24020 
replace CA04_enep = 2.310452 if ces04_fed03 == 24021 
replace CA04_enep = 2.622708 if ces04_fed03 == 24022 
replace CA04_enep = 3.283058 if ces04_fed03 == 24023 
replace CA04_enep = 2.890032 if ces04_fed03 == 24024 
replace CA04_enep = 2.174089 if ces04_fed03 == 24025 
replace CA04_enep = 2.539317 if ces04_fed03 == 24026 
replace CA04_enep = 2.2631 if ces04_fed03 == 24027 
replace CA04_enep = 2.006826 if ces04_fed03 == 24028 
replace CA04_enep = 2.387405 if ces04_fed03 == 24029 
replace CA04_enep = 2.309823 if ces04_fed03 == 24030 
replace CA04_enep = 2.431849 if ces04_fed03 == 24031 
replace CA04_enep = 2.576204 if ces04_fed03 == 24032 
replace CA04_enep = 2.672137 if ces04_fed03 == 24033 
replace CA04_enep = 3.19504 if ces04_fed03 == 24034 
replace CA04_enep = 2.25981 if ces04_fed03 == 24035 
replace CA04_enep = 3.130916 if ces04_fed03 == 24036 
replace CA04_enep = 3.083461 if ces04_fed03 == 24037 
replace CA04_enep = 3.372744 if ces04_fed03 == 24038 
replace CA04_enep = 2.395095 if ces04_fed03 == 24039 
replace CA04_enep = 2.326349 if ces04_fed03 == 24040 
replace CA04_enep = 2.390761 if ces04_fed03 == 24041 
replace CA04_enep = 2.856171 if ces04_fed03 == 24042 
replace CA04_enep = 1.851958 if ces04_fed03 == 24043 
replace CA04_enep = 1.699864 if ces04_fed03 == 24044 
replace CA04_enep = 2.851052 if ces04_fed03 == 24045 
replace CA04_enep = 2.528293 if ces04_fed03 == 24046 
replace CA04_enep = 3.295042 if ces04_fed03 == 24047 
replace CA04_enep = 2.945846 if ces04_fed03 == 24048 
replace CA04_enep = 2.246414 if ces04_fed03 == 24049 
replace CA04_enep = 3.490068 if ces04_fed03 == 24050 
replace CA04_enep = 3.230559 if ces04_fed03 == 24051 
replace CA04_enep = 2.887233 if ces04_fed03 == 24052 
replace CA04_enep = 1.893024 if ces04_fed03 == 24053 
replace CA04_enep = 2.09914 if ces04_fed03 == 24054 
replace CA04_enep = 2.528121 if ces04_fed03 == 24055 
replace CA04_enep = 2.48588 if ces04_fed03 == 24056 
replace CA04_enep = 2.257974 if ces04_fed03 == 24057 
replace CA04_enep = 2.362831 if ces04_fed03 == 24058 
replace CA04_enep = 2.035404 if ces04_fed03 == 24059 
replace CA04_enep = 2.391466 if ces04_fed03 == 24060 
replace CA04_enep = 2.257248 if ces04_fed03 == 24061 
replace CA04_enep = 2.483375 if ces04_fed03 == 24062 
replace CA04_enep = 2.215367 if ces04_fed03 == 24063 
replace CA04_enep = 2.28977 if ces04_fed03 == 24064 
replace CA04_enep = 2.619126 if ces04_fed03 == 24065 
replace CA04_enep = 2.063848 if ces04_fed03 == 24066 
replace CA04_enep = 2.159764 if ces04_fed03 == 24067 
replace CA04_enep = 2.45209 if ces04_fed03 == 24068 
replace CA04_enep = 2.611676 if ces04_fed03 == 24069 
replace CA04_enep = 2.248142 if ces04_fed03 == 24070 
replace CA04_enep = 1.967427 if ces04_fed03 == 24071 
replace CA04_enep = 2.467078 if ces04_fed03 == 24072 
replace CA04_enep = 2.805457 if ces04_fed03 == 24073 
replace CA04_enep = 1.988076 if ces04_fed03 == 24074 
replace CA04_enep = 2.762235 if ces04_fed03 == 24075 
replace CA04_enep = 2.649073 if ces04_fed03 == 35001 
replace CA04_enep = 3.089901 if ces04_fed03 == 35002 
replace CA04_enep = 3.091655 if ces04_fed03 == 35003 
replace CA04_enep = 2.791565 if ces04_fed03 == 35004 
replace CA04_enep = 2.809716 if ces04_fed03 == 35005 
replace CA04_enep = 2.75435 if ces04_fed03 == 35006 
replace CA04_enep = 2.898375 if ces04_fed03 == 35007 
replace CA04_enep = 2.649392 if ces04_fed03 == 35008 
replace CA04_enep = 3.273408 if ces04_fed03 == 35009 
replace CA04_enep = 2.750216 if ces04_fed03 == 35010 
replace CA04_enep = 3.175368 if ces04_fed03 == 35011 
replace CA04_enep = 2.633023 if ces04_fed03 == 35012 
replace CA04_enep = 2.959162 if ces04_fed03 == 35013 
replace CA04_enep = 2.965157 if ces04_fed03 == 35014 
replace CA04_enep = 2.604721 if ces04_fed03 == 35015 
replace CA04_enep = 2.531143 if ces04_fed03 == 35016 
replace CA04_enep = 2.241647 if ces04_fed03 == 35017 
replace CA04_enep = 2.854856 if ces04_fed03 == 35018 
replace CA04_enep = 2.282641 if ces04_fed03 == 35019 
replace CA04_enep = 3.002391 if ces04_fed03 == 35020 
replace CA04_enep = 3.154917 if ces04_fed03 == 35021 
replace CA04_enep = 2.31959 if ces04_fed03 == 35022 
replace CA04_enep = 2.711022 if ces04_fed03 == 35023 
replace CA04_enep = 2.213318 if ces04_fed03 == 35024 
replace CA04_enep = 2.634957 if ces04_fed03 == 35025 
replace CA04_enep = 2.859868 if ces04_fed03 == 35026 
replace CA04_enep = 3.195972 if ces04_fed03 == 35027 
replace CA04_enep = 2.853617 if ces04_fed03 == 35028 
replace CA04_enep = 2.943134 if ces04_fed03 == 35029 
replace CA04_enep = 2.562989 if ces04_fed03 == 35030 
replace CA04_enep = 2.877293 if ces04_fed03 == 35031 
replace CA04_enep = 3.109373 if ces04_fed03 == 35032 
replace CA04_enep = 3.164762 if ces04_fed03 == 35033 
replace CA04_enep = 2.755846 if ces04_fed03 == 35034 
replace CA04_enep = 3.19038 if ces04_fed03 == 35035 
replace CA04_enep = 2.781266 if ces04_fed03 == 35036 
replace CA04_enep = 2.957568 if ces04_fed03 == 35037 
replace CA04_enep = 3.002501 if ces04_fed03 == 35038 
replace CA04_enep = 2.882156 if ces04_fed03 == 35039 
replace CA04_enep = 2.828023 if ces04_fed03 == 35040 
replace CA04_enep = 2.64088 if ces04_fed03 == 35041 
replace CA04_enep = 3.244131 if ces04_fed03 == 35042 
replace CA04_enep = 3.110862 if ces04_fed03 == 35043 
replace CA04_enep = 2.958486 if ces04_fed03 == 35044 
replace CA04_enep = 2.006116 if ces04_fed03 == 35045 
replace CA04_enep = 2.962791 if ces04_fed03 == 35046 
replace CA04_enep = 2.451456 if ces04_fed03 == 35047 
replace CA04_enep = 2.474354 if ces04_fed03 == 35048 
replace CA04_enep = 2.447289 if ces04_fed03 == 35049 
replace CA04_enep = 2.546971 if ces04_fed03 == 35050 
replace CA04_enep = 2.710208 if ces04_fed03 == 35051 
replace CA04_enep = 2.637629 if ces04_fed03 == 35052 
replace CA04_enep = 2.769916 if ces04_fed03 == 35053 
replace CA04_enep = 3.051622 if ces04_fed03 == 35054 
replace CA04_enep = 2.957741 if ces04_fed03 == 35055 
replace CA04_enep = 2.984242 if ces04_fed03 == 35056 
replace CA04_enep = 2.884992 if ces04_fed03 == 35057 
replace CA04_enep = 2.937441 if ces04_fed03 == 35058 
replace CA04_enep = 2.567858 if ces04_fed03 == 35059 
replace CA04_enep = 2.478519 if ces04_fed03 == 35060 
replace CA04_enep = 3.240535 if ces04_fed03 == 35061 
replace CA04_enep = 3.256707 if ces04_fed03 == 35062 
replace CA04_enep = 2.649722 if ces04_fed03 == 35063 
replace CA04_enep = 2.982505 if ces04_fed03 == 35064 
replace CA04_enep = 2.945575 if ces04_fed03 == 35065 
replace CA04_enep = 2.867292 if ces04_fed03 == 35066 
replace CA04_enep = 3.134302 if ces04_fed03 == 35067 
replace CA04_enep = 3.080571 if ces04_fed03 == 35068 
replace CA04_enep = 2.900337 if ces04_fed03 == 35069 
replace CA04_enep = 3.156251 if ces04_fed03 == 35070 
replace CA04_enep = 3.023579 if ces04_fed03 == 35071 
replace CA04_enep = 2.397543 if ces04_fed03 == 35072 
replace CA04_enep = 2.895777 if ces04_fed03 == 35073 
replace CA04_enep = 2.467906 if ces04_fed03 == 35074 
replace CA04_enep = 2.403942 if ces04_fed03 == 35075 
replace CA04_enep = 3.099111 if ces04_fed03 == 35076 
replace CA04_enep = 2.437586 if ces04_fed03 == 35077 
replace CA04_enep = 3.332035 if ces04_fed03 == 35078 
replace CA04_enep = 2.99387 if ces04_fed03 == 35079 
replace CA04_enep = 2.145336 if ces04_fed03 == 35080 
replace CA04_enep = 2.474353 if ces04_fed03 == 35081 
replace CA04_enep = 2.440784 if ces04_fed03 == 35082 
replace CA04_enep = 2.537599 if ces04_fed03 == 35083 
replace CA04_enep = 2.836308 if ces04_fed03 == 35084 
replace CA04_enep = 2.91931 if ces04_fed03 == 35085 
replace CA04_enep = 2.881849 if ces04_fed03 == 35086 
replace CA04_enep = 2.824267 if ces04_fed03 == 35087 
replace CA04_enep = 3.021751 if ces04_fed03 == 35088 
replace CA04_enep = 2.366819 if ces04_fed03 == 35089 
replace CA04_enep = 3.191062 if ces04_fed03 == 35090 
replace CA04_enep = 3.139839 if ces04_fed03 == 35091 
replace CA04_enep = 2.798892 if ces04_fed03 == 35092 
replace CA04_enep = 2.503668 if ces04_fed03 == 35093 
replace CA04_enep = 2.548268 if ces04_fed03 == 35094 
replace CA04_enep = 2.661213 if ces04_fed03 == 35095 
replace CA04_enep = 2.167271 if ces04_fed03 == 35096 
replace CA04_enep = 3.185623 if ces04_fed03 == 35097 
replace CA04_enep = 2.884541 if ces04_fed03 == 35098 
replace CA04_enep = 2.81702 if ces04_fed03 == 35099 
replace CA04_enep = 2.266954 if ces04_fed03 == 35100 
replace CA04_enep = 3.000967 if ces04_fed03 == 35101 
replace CA04_enep = 2.886743 if ces04_fed03 == 35102 
replace CA04_enep = 2.56814 if ces04_fed03 == 35103 
replace CA04_enep = 2.89162 if ces04_fed03 == 35104 
replace CA04_enep = 2.344426 if ces04_fed03 == 35105 
replace CA04_enep = 2.176859 if ces04_fed03 == 35106 
replace CA04_enep = 2.745888 if ces04_fed03 == 46001 
replace CA04_enep = 2.577219 if ces04_fed03 == 46002 
replace CA04_enep = 2.780697 if ces04_fed03 == 46003 
replace CA04_enep = 2.620895 if ces04_fed03 == 46004 
replace CA04_enep = 2.720164 if ces04_fed03 == 46005 
replace CA04_enep = 3.086795 if ces04_fed03 == 46006 
replace CA04_enep = 2.095368 if ces04_fed03 == 46007 
replace CA04_enep = 2.135379 if ces04_fed03 == 46008 
replace CA04_enep = 2.886498 if ces04_fed03 == 46009 
replace CA04_enep = 2.885613 if ces04_fed03 == 46010 
replace CA04_enep = 2.883526 if ces04_fed03 == 46011 
replace CA04_enep = 2.624342 if ces04_fed03 == 46012 
replace CA04_enep = 2.549341 if ces04_fed03 == 46013 
replace CA04_enep = 2.968286 if ces04_fed03 == 46014 
replace CA04_enep = 2.429337 if ces04_fed03 == 47001 
replace CA04_enep = 3.057184 if ces04_fed03 == 47002 
replace CA04_enep = 3.572546 if ces04_fed03 == 47003 
replace CA04_enep = 2.316983 if ces04_fed03 == 47004 
replace CA04_enep = 3.156382 if ces04_fed03 == 47005 
replace CA04_enep = 2.888494 if ces04_fed03 == 47006 
replace CA04_enep = 3.416799 if ces04_fed03 == 47007 
replace CA04_enep = 3.195987 if ces04_fed03 == 47008 
replace CA04_enep = 4.12197 if ces04_fed03 == 47009 
replace CA04_enep = 2.791629 if ces04_fed03 == 47010 
replace CA04_enep = 2.806857 if ces04_fed03 == 47011 
replace CA04_enep = 3.718965 if ces04_fed03 == 47012 
replace CA04_enep = 2.428086 if ces04_fed03 == 47013 
replace CA04_enep = 2.205732 if ces04_fed03 == 47014 
replace CA04_enep = 2.298351 if ces04_fed03 == 48001 
replace CA04_enep = 2.306385 if ces04_fed03 == 48002 
replace CA04_enep = 2.727073 if ces04_fed03 == 48003 
replace CA04_enep = 2.192623 if ces04_fed03 == 48004 
replace CA04_enep = 2.10525 if ces04_fed03 == 48005 
replace CA04_enep = 2.716132 if ces04_fed03 == 48006 
replace CA04_enep = 1.855742 if ces04_fed03 == 48007 
replace CA04_enep = 1.967427 if ces04_fed03 == 48008 
replace CA04_enep = 2.449726 if ces04_fed03 == 48009 
replace CA04_enep = 1.525091 if ces04_fed03 == 48010 
replace CA04_enep = 2.66321 if ces04_fed03 == 48011 
replace CA04_enep = 2.772142 if ces04_fed03 == 48012 
replace CA04_enep = 2.92483 if ces04_fed03 == 48013 
replace CA04_enep = 2.489171 if ces04_fed03 == 48014 
replace CA04_enep = 2.44818 if ces04_fed03 == 48015 
replace CA04_enep = 2.430976 if ces04_fed03 == 48016 
replace CA04_enep = 2.268789 if ces04_fed03 == 48017 
replace CA04_enep = 3.328712 if ces04_fed03 == 48018 
replace CA04_enep = 2.225019 if ces04_fed03 == 48019 
replace CA04_enep = 1.717712 if ces04_fed03 == 48020 
replace CA04_enep = 1.662192 if ces04_fed03 == 48021 
replace CA04_enep = 2.106082 if ces04_fed03 == 48022 
replace CA04_enep = 1.718443 if ces04_fed03 == 48023 
replace CA04_enep = 1.768103 if ces04_fed03 == 48024 
replace CA04_enep = 2.025532 if ces04_fed03 == 48025 
replace CA04_enep = 1.76677 if ces04_fed03 == 48026 
replace CA04_enep = 1.89229 if ces04_fed03 == 48027 
replace CA04_enep = 1.992956 if ces04_fed03 == 48028 
replace CA04_enep = 2.293154 if ces04_fed03 == 59001 
replace CA04_enep = 3.296692 if ces04_fed03 == 59002 
replace CA04_enep = 3.288726 if ces04_fed03 == 59003 
replace CA04_enep = 3.029739 if ces04_fed03 == 59004 
replace CA04_enep = 2.730567 if ces04_fed03 == 59005 
replace CA04_enep = 2.908101 if ces04_fed03 == 59006 
replace CA04_enep = 3.268045 if ces04_fed03 == 59007 
replace CA04_enep = 3.50508 if ces04_fed03 == 59008 
replace CA04_enep = 3.36395 if ces04_fed03 == 59009 
replace CA04_enep = 3.19269 if ces04_fed03 == 59010 
replace CA04_enep = 2.990559 if ces04_fed03 == 59011 
replace CA04_enep = 2.75214 if ces04_fed03 == 59012 
replace CA04_enep = 3.098514 if ces04_fed03 == 59013 
replace CA04_enep = 3.311413 if ces04_fed03 == 59014 
replace CA04_enep = 3.042974 if ces04_fed03 == 59015 
replace CA04_enep = 3.374169 if ces04_fed03 == 59016 
replace CA04_enep = 3.412606 if ces04_fed03 == 59017 
replace CA04_enep = 3.062648 if ces04_fed03 == 59018 
replace CA04_enep = 3.096524 if ces04_fed03 == 59019 
replace CA04_enep = 2.915869 if ces04_fed03 == 59020 
replace CA04_enep = 3.188354 if ces04_fed03 == 59021 
replace CA04_enep = 2.440109 if ces04_fed03 == 59022 
replace CA04_enep = 2.881036 if ces04_fed03 == 59023 
replace CA04_enep = 3.761023 if ces04_fed03 == 59024 
replace CA04_enep = 3.325567 if ces04_fed03 == 59025 
replace CA04_enep = 3.377017 if ces04_fed03 == 59026 
replace CA04_enep = 2.93102 if ces04_fed03 == 59027 
replace CA04_enep = 3.434255 if ces04_fed03 == 59028 
replace CA04_enep = 3.242758 if ces04_fed03 == 59029 
replace CA04_enep = 2.503833 if ces04_fed03 == 59030 
replace CA04_enep = 3.360678 if ces04_fed03 == 59031 
replace CA04_enep = 3.01986 if ces04_fed03 == 59032 
replace CA04_enep = 2.704419 if ces04_fed03 == 59033 
replace CA04_enep = 3.077163 if ces04_fed03 == 59034 
replace CA04_enep = 3.562401 if ces04_fed03 == 59035 
replace CA04_enep = 3.484342 if ces04_fed03 == 59036 
replace CA04_enep = 3.114799 if ces04_fed03 == 60001 
replace CA04_enep = 2.945036 if ces04_fed03 == 61001 
replace CA04_enep = 3.003208 if ces04_fed03 == 62001


********************************
** INCUMBENT PARTY REELECTED **
********************************

* Note: district boundaries were modified between the 2000 and 2004 federal elections.


**************************************************
** INDEPENDENT VARIABLES: 2004 FEDERAL ELECTION **
**************************************************

* Party identification (national)

gen CA04_pid1 = _v49
gen CA04_pid2 = _v50

recode CA04_pid1 CA04_pid2 (5=2) // Alliance recoded as Conservative
recode CA04_pid1 CA04_pid2 (6=2) // Progressive Conservative recoded as Conservative

gen CA04_closer = ces04_cps_q4

recode CA04_closer (5=2) // Alliance recoded as Conservative
recode CA04_closer (6=2) // Progressive Conservative recoded as Conservative

gen CA04_pid = max(_v49,_v50) // Merge answers from randomized question wording experiment

gen CA04_pidstatus_whole = .

replace CA04_pidstatus_whole = 9999 if CA04_pid == 99 & CA04_closer == .
replace CA04_pidstatus_whole = 9999 if CA04_pid == . & CA04_closer == .
replace CA04_pidstatus_whole = 9999 if ces04_cps_q3 == 1 & CA04_closer == 98 | ces04_cps_q3 == 1 & CA04_closer == 99
replace CA04_pidstatus_whole = 9999 if CA04_pid == 98 & ces04_cps_q3 == 8 | CA04_pid == 98 & ces04_cps_q3 == 9 | CA04_pid == 99 & ces04_cps_q3 == 8 | CA04_pid == 99 & ces04_cps_q3 == 9 | CA04_pid == 0 & ces04_cps_q3 == 9

replace CA04_pidstatus_whole = 2 if CA04_pid == 0 & ces04_cps_q3 == 5 | CA04_pid == 0 & ces04_cps_q3 == 8 | CA04_pid == 98 & ces04_cps_q3 == 5

replace CA04_pidstatus_whole = 3 if CA04_pid == 1 & CA04_pidstatus_whole!=2 & CA04_pidstatus_whole!=9999
replace CA04_pidstatus_whole = 3 if CA04_closer == 1 & CA04_pidstatus_whole!=2 & CA04_pidstatus_whole!=9999

replace CA04_pidstatus_whole = 1 if CA04_pid!=1 & CA04_pid!=. & CA04_pidstatus_whole!=2 & CA04_pidstatus_whole!=3 & CA04_pidstatus_whole!=9999
replace CA04_pidstatus_whole = 1 if CA04_closer!=1 & CA04_closer!=. & CA04_pidstatus_whole!=2 & CA04_pidstatus_whole!=3 & CA04_pidstatus_whole!=9999

gen CA04_winner_leaner_whole = 1 if ces04_cps_q3 == 1 & CA04_pidstatus_whole == 3
gen CA04_loser_leaner_whole = 1 if ces04_cps_q3 == 1 & CA04_pidstatus_whole == 1

replace CA04_pidstatus_whole = . if CA04_pidstatus_whole == 9999
 
label define pidstatus 1 "Loser PID" 2 "No PID" 3 "Winner PID"
label values CA04_pidstatus_whole pidstatus

* Party identification scale (national)

gen CA04_pidscale_whole = .

replace CA04_pidscale_whole = 1 if CA04_pidstatus_whole == 1 & ces04_cps_q2 == 1
replace CA04_pidscale_whole = 2 if CA04_pidstatus_whole == 1 & ces04_cps_q2 == 3
replace CA04_pidscale_whole = 3 if CA04_pidstatus_whole == 1 & ces04_cps_q2 == 5 | CA04_loser_leaner_whole == 1
replace CA04_pidscale_whole = 4 if CA04_pidstatus_whole == 2
replace CA04_pidscale_whole = 5 if CA04_pidstatus_whole == 3 & ces04_cps_q2 == 5 | CA04_winner_leaner_whole == 1
replace CA04_pidscale_whole = 6 if CA04_pidstatus_whole == 3 & ces04_cps_q2 == 3
replace CA04_pidscale_whole = 7 if CA04_pidstatus_whole == 3 & ces04_cps_q2 == 1

label define pidscale 1 "Very strong loser PID" 2 "Fairly strong loser PID" 3 "Not very strong loser PID" 4 "No PID" 5 "Not very strong winner PID" 6 "Fairly strong winner PID" 7 "Very strong winner PID"
label values CA04_pidscale_whole pidscale

* Party identification (district)

gen CA04_pidstatus_district = .

replace CA04_pidstatus_district = 9999 if CA04_pid == 99 & CA04_closer == .
replace CA04_pidstatus_district = 9999 if CA04_pid == . & CA04_closer == . // Replace by 9999 if missing data for party identification
replace CA04_pidstatus_district = 9999 if ces04_cps_q3 == 1 & CA04_closer == 98 | ces04_cps_q3 == 1 & CA04_closer == 99 // Replace by 9999 if respondent feels a little closer to one party but don't know which or refused to say which
replace CA04_pidstatus_district = 9999 if CA04_pid == 98 & ces04_cps_q3 == 8 | CA04_pid == 98 & ces04_cps_q3 == 9 | CA04_pid == 99 & ces04_cps_q3 == 8 | CA04_pid == 99 & ces04_cps_q3 == 9 // Replace by 9999 if respondent don't know if he/she identifies with a party or refused to say and don't know if he/she feels a little closer to one party or refused to say 

replace CA04_pidstatus_district = 2 if CA04_pid == 0 & ces04_cps_q3 == 5 | CA04_pid == 0 & ces04_cps_q3 == 8 | CA04_pid == 98 & ces04_cps_q3 == 5 // No PID

replace CA04_pidstatus_district = 3 if CA04_pid == CA04_district_outcome & CA04_pidstatus_district!=2 & CA04_pidstatus_district!=9999 // Winner PID
replace CA04_pidstatus_district = 3 if CA04_closer == CA04_district_outcome & CA04_pidstatus_district!=2 & CA04_pidstatus_district!=9999 // Winner PID

replace CA04_pidstatus_district = 1 if CA04_pid!=CA04_district_outcome & CA04_pid!=. & CA04_pidstatus_district!=2 & CA04_pidstatus_district!=3 & CA04_pidstatus_district!=9999 // Loser PID
replace CA04_pidstatus_district = 1 if CA04_closer!=CA04_district_outcome & CA04_closer!=. & CA04_pidstatus_district!=2 & CA04_pidstatus_district!=3 & CA04_pidstatus_district!=9999 // Loser PID

gen CA04_winner_leaner_district = 1 if ces04_cps_q3 == 1 & CA04_pidstatus_district == 3 // Winner leaner
gen CA04_loser_leaner_district = 1 if ces04_cps_q3 == 1 & CA04_pidstatus_district == 1 // Loser leaner

replace CA04_pidstatus_district = . if CA04_pidstatus_district == 9999 // Missing data
 
label values CA04_pidstatus_district pidstatus

* Party identification scale (district)

gen CA04_pidscale_district = .

replace CA04_pidscale_district = 1 if CA04_pidstatus_district == 1 & ces04_cps_q2 == 1 // Strong (very strongly) loser PID
replace CA04_pidscale_district = 2 if CA04_pidstatus_district == 1 & ces04_cps_q2 == 3 // Moderate (fairly strongly) loser PID
replace CA04_pidscale_district = 3 if CA04_pidstatus_district == 1 & ces04_cps_q2 == 5 | CA04_loser_leaner_district == 1 // Moderate (not very strongly) loser PID
replace CA04_pidscale_district = 4 if CA04_pidstatus_district == 2 // No PID
replace CA04_pidscale_district = 5 if CA04_pidstatus_district == 3 & ces04_cps_q2 == 5 | CA04_winner_leaner_district == 1 // Weak (not very strongly) winner PID
replace CA04_pidscale_district = 6 if CA04_pidstatus_district == 3 & ces04_cps_q2 == 3 // Moderate (fairly strongly) winner PID
replace CA04_pidscale_district = 7 if CA04_pidstatus_district == 3 & ces04_cps_q2 == 1 // Strong (very strongly) winner PID

label values CA04_pidscale_district pidscale

* Interest for election

gen CA04_interest = ces04_cps_a5 // Interest for election

recode CA04_interest (98=.) // Recode "don't know" as missing data
recode CA04_interest (99=.) // Recode "refused" as missing data

* Election news attentiveness

gen CA04_tv = ces04_cps_a1 // Attention paid to election on TV

recode CA04_tv (98=.) // Recode "don't know" as missing data
recode CA04_tv (99=.) // Recode "refused" as missing data

gen CA04_radio = ces04_cps_a2 // Attention paid to election on radio

recode CA04_radio (98=.) // Recode "don't know" as missing data
recode CA04_radio (99=.) // Recode "refused" as missing data

gen CA04_newspapers = ces04_cps_a3 // Attention paid to election in newspapers

recode CA04_newspapers (98=.) // Recode "don't know" as missing data
recode CA04_newspapers (99=.) // Recode "refused" as missing data

gen CA04_internet = ces04_cps_a4 // Attention paid to election on internet

recode CA04_internet (97=.) // Recode "R volunteers: No access to Internet" as missing data
recode CA04_internet (98=.) // Recode "don't know" as missing data
recode CA04_internet (99=.) // Recode "refused" as missing data

egen CA04_news = rowmax(CA04_tv CA04_radio CA04_newspapers CA04_internet) // Election news attentiveness

* Education

gen CA04_education = ces04_cps_s3 // Highest level of education completed by respondent

recode CA04_education (98=.) // Recode "don't know" as missing data
recode CA04_education (99=.) // Recode "refused" as missing data

* Response date

gen CA04_surveydate = mdy(ces04_cps_intmonth,ces04_cps_intday,ces04_cps_intyear) // Interview date

format %tdMon_DD,_CCYY CA04_surveydate // Format interview date: DDMMYYYY

gen CA04_edate = 20040628 // Election date

gen CA04_electiondate = date(string(CA04_edate,"%8.0f"),"YMD") 

format %tdMon_DD,_CCYY CA04_electiondate // Format election date: DDMMYYYY

gen CA04_time = CA04_electiondate - CA04_surveydate // Number of days between interview and election

* Gender

gen CA04_male = gender // Gender

recode CA04_male (5=0) // Recode female = 0

* Age

gen CA04_yearofbirth = yearofbirth // Year of birth

recode CA04_yearofbirth (9998=.) // Recode "don't know" as missing data
recode CA04_yearofbirth (9999=.) // Recode "refused" as missing data

gen CA04_age = 2004 - CA04_yearofbirth // Age

replace CA04_age = . if CA04_age < 17 // Recode respondents less than 17 years old as missing data

* Name of NDP leader - Correct answer (Jack Layton) = 1, Incorrect answer = 0

gen CA04_ndp_districtleader = ces04_cps_e1 // NDP leader

recode CA04_ndp_districtleader (5=0) // Recode "any other answer" as incorrect answer
recode CA04_ndp_districtleader (8=0) // Recode "don't know" as incorrect answer
recode CA04_ndp_districtleader (9=.) // Recode "refused" as missing data

* Name of Conservative leader - Correct answer (Stephen Harper) = 1, Incorrect answer = 0

gen CA04_cpcleader = ces04_cps_e2 // Conservative leader

recode CA04_cpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA04_cpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA04_cpcleader (9=.) // Recode "refused" as missing data

* Name of Liberal leader - Correct answer (Paul Martin) = 1, Incorrect answer = 0

gen CA04_lpcleader = ces04_cps_e4 // Liberal leader

recode CA04_lpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA04_lpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA04_lpcleader (9=.) // Recode "refused" as missing data

* Name of the Minister of Finance of Canada - Correct answer (Ralph Goodale) = 1, Incorrect answer = 0

gen CA04_financeminister = ces04_cps_know_2 // Minister of Finance of Canada

recode CA04_financeminister (5=0) // Recode "any other answer" as incorrect answer
recode CA04_financeminister (8=0) // Recode "don't know" as incorrect answer
recode CA04_financeminister (9=.) // Recode "refused" as missing data

* Name of the British Prime Minister - Correct answer (Tony Blair) = 1, Incorrect answer = 0

gen CA04_britishpm = ces04_cps_know_3 // British Prime Minister

recode CA04_britishpm (5=0) // Recode "any other answer" as incorrect answer
recode CA04_britishpm (8=0) // Recode "don't know" as incorrect answer
recode CA04_britishpm (9=.) // Recode "refused" as missing data

* Name of the female cabinet minister who ran against Paul Martin for the leadership of the Liberal Party - Correct answer (Sheila Copps) = 1, Incorrect answer = 0

gen CA04_femaleliberalrace = ces04_cps_know_4 // Female cabinet minister who ran against Paul Martin for the leadership of the Liberal Party

recode CA04_femaleliberalrace (5=0) // Recode "any other answer" as incorrect answer
recode CA04_femaleliberalrace (8=0) // Recode "don't know" as incorrect answer
recode CA04_femaleliberalrace (9=.) // Recode "refused" as missing data

* Name of the provincial premier - Correct answer (Danny Williams in Newfoundland, Pat Binns in Prince Edward Island, John Hamm in Nova Scotia, Bernard Lord in New Brunswick, Jean Charest in Quebec, Dalton McGuinty in Ontario, Gary Doer in Manitoba, Lorne Calvert in Saskatchewan, Ralph Klein in Alberta, Gordon Campbell in British Columbia) = 1, Incorrect answer = 0

gen CA04_premier = ces04_cps_know_1 // Provincial premier

recode CA04_premier (10=1) if ces04_province == 10 // Premier of Newfoundland: correct answer
recode CA04_premier (11=1) if ces04_province == 11 // Premier of Prince Edward Island: correct answer
recode CA04_premier (12=1) if ces04_province == 12 // Premier of Nova Scotia: correct answer
recode CA04_premier (13=1) if ces04_province == 13 // Premier of New Brunswick: correct answer
recode CA04_premier (24=1) if ces04_province == 24 // Premier of Quebec: correct answer
recode CA04_premier (35=1) if ces04_province == 35 // Premier of Ontario: correct answer
recode CA04_premier (46=1) if ces04_province == 46 // Premier of Manitoba: correct answer
recode CA04_premier (47=1) if ces04_province == 47 // Premier of Saskatchewan: correct answer
recode CA04_premier (48=1) if ces04_province == 48 // Premier of Alberta: correct answer
recode CA04_premier (59=1) if ces04_province == 59 // Premier of British Columbia: correct answer
recode CA04_premier (97=0) // Recode "any other name" as incorrect answer
recode CA04_premier (98=0) // Recode "don't know" as incorrect answer
recode CA04_premier (99=.) // Recode "refused" as missing data

recode CA04_premier (10=0) if ces04_province!=10 & CA04_premier!=. // Premier of Newfoundland: incorrect answer
recode CA04_premier (11=0) if ces04_province!=11 & CA04_premier!=. // Premier of Prince Edward Island: incorrect answer
recode CA04_premier (12=0) if ces04_province!=12 & CA04_premier!=. // Premier of Nova Scotia: incorrect answer
recode CA04_premier (13=0) if ces04_province!=13 & CA04_premier!=. // Premier of New Brunswick: incorrect answer
recode CA04_premier (24=0) if ces04_province!=24 & CA04_premier!=. // Premier of Quebec: incorrect answer
recode CA04_premier (35=0) if ces04_province!=35 & CA04_premier!=. // Premier of Ontario: incorrect answer
recode CA04_premier (46=0) if ces04_province!=46 & CA04_premier!=. // Premier of Manitoba: incorrect answer
recode CA04_premier (47=0) if ces04_province!=47 & CA04_premier!=. // Premier of Saskatchewan: incorrect answer
recode CA04_premier (48=0) if ces04_province!=48 & CA04_premier!=. // Premier of Alberta: incorrect answer
recode CA04_premier (59=0) if ces04_province!=59 & CA04_premier!=. // Premier of British Columbia: incorrect answer

* Party promising to get rid of the gun registry - Correct answer (Conservative) = 1, Incorrect answer = 0

gen CA04_gunregistry = _v7 // Gun registery

recode CA04_gunregistry (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_gunregistry (8=0) // Recode "don't know" as incorrect answer
recode CA04_gunregistry (9=.) // Recode "refused" as missing data

* Party promising to do away with the Federal Sales Tax/GST on family essentials - Correct answer (NDP) = 1, Incorrect answer = 0

gen CA04_salestax = _v15 // Federal Sales Tax/GST

recode CA04_salestax (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_salestax (8=0) // Recode "don't know" as incorrect answer
recode CA04_salestax (9=.) // Recode "refused" as missing data

* Party promising to increase military spending by 2 billion dollars each year - Correct answer (Conservative) = 1, Incorrect answer = 0

gen CA04_military = _v21 // Military spending

recode CA04_military (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_military (8=0) // Recode "don't know" as incorrect answer
recode CA04_military (9=.) // Recode "refused" as missing data

* Party promising to spend 250 million for fighting AIDS in poor countries - Correct answer (Liberal) = 1, Incorrect answer = 0

gen CA04_aids = _v27 // 250 million for fighting AIDS

recode CA04_aids (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_aids (8=0) // Recode "don't know" as incorrect answer
recode CA04_aids (9=.) // Recode "refused" as missing data

* Party promising to spend 4 billion dollars to reduce waiting times for surgeries - Correct answer (Liberal) = 1, Incorrect answer = 0

gen CA04_waittime = _v33 // Waiting times for surgeries

recode CA04_waittime (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_waittime (8=0) // Recode "don't know" as incorrect answer
recode CA04_waittime (9=.) // Recode "refused" as missing data

* Party promising an inheritance tax on estates over 1 million dollars - Correct answer (NDP) = 1, Incorrect answer = 0

gen CA04_inheritance = _v40 // Inheritance tax

recode CA04_inheritance (7=0) // Recode "R volunteers: all of them" as incorrect answer
recode CA04_inheritance (8=0) // Recode "don't know" as incorrect answer
recode CA04_inheritance (9=.) // Recode "refused" as missing data

* Political knowledge index

gen CA04_knowledge = CA04_ndp_districtleader + CA04_cpcleader+ CA04_lpcleader + CA04_financeminister + CA04_britishpm + CA04_femaleliberalrace + CA04_premier + CA04_gunregistry + CA04_salestax + CA04_military + CA04_aids + CA04_waittime + CA04_inheritance // Political knowledge index

* Political discussion (pre)

gen CA04_discussion = ces04_cps_c5

recode CA04_discussion (8=.)
recode CA04_discussion (9=.)

replace CA04_discussion = 30 if CA04_discussion == 1
replace CA04_discussion = 20 if CA04_discussion == 3
replace CA04_discussion = 10 if CA04_discussion == 5

replace CA04_discussion = 2 if CA04_discussion == 30
replace CA04_discussion = 1 if CA04_discussion == 20
replace CA04_discussion = 0 if CA04_discussion == 10

* Political discussion (post)

gen CA04_discussion_post = ces04_pes_cont6

recode CA04_discussion_post (8=.)
recode CA04_discussion_post (9=.)

replace CA04_discussion_post = 30 if CA04_discussion_post == 1
replace CA04_discussion_post = 20 if CA04_discussion_post == 3
replace CA04_discussion_post = 10 if CA04_discussion_post == 5

replace CA04_discussion_post = 2 if CA04_discussion_post == 30
replace CA04_discussion_post = 1 if CA04_discussion_post == 20
replace CA04_discussion_post = 0 if CA04_discussion_post == 10

* Network size

gen CA04_size = ces04_mbs_c1

recode CA04_size (-9=.)

replace CA04_size = . if CA04_size >= 999

gen CA04_size_3pts = CA04_size
replace CA04_size_3pts = 0 if CA04_size == 1
replace CA04_size_3pts = 1 if CA04_size == 2
replace CA04_size_3pts = 1 if CA04_size == 3
replace CA04_size_3pts = 1 if CA04_size == 4
replace CA04_size_3pts = 2 if CA04_size > 4 & CA04_size!=.

* Social contact 

gen CA04_contact = ces04_mbs_c2

recode CA04_contact (-9=.)

replace CA04_contact = 5 - CA04_contact

replace CA04_contact = 0 if CA04_size == 0

* Diversity

gen CA04_same_sex = ces04_mbs_c3a
gen CA04_same_age = ces04_mbs_c3b
gen CA04_same_education = ces04_mbs_c3c
gen CA04_same_income = ces04_mbs_c3d
gen CA04_same_race = ces04_mbs_c3e

recode CA04_same_sex CA04_same_age CA04_same_education CA04_same_income CA04_same_race (-9=.)

replace CA04_same_sex = 3 - CA04_same_sex

replace CA04_same_age = 3 - CA04_same_age

replace CA04_same_education = 3 - CA04_same_education

replace CA04_same_income = 3 - CA04_same_income

replace CA04_same_race = 3 - CA04_same_race

gen CA04_diversity_complete = 1 if CA04_same_sex!=. & CA04_same_age!=. & CA04_same_education!=. & CA04_same_income!=. & CA04_same_race!=.

gen CA04_diversity = CA04_same_sex + CA04_same_age + CA04_same_education + CA04_same_income + CA04_same_race if CA04_diversity_complete == 1

* Main source of information

gen CA04_network_main = 1 if ces04_cps_a8 == 5 | ces04_cps_a8 == 6

replace CA04_network_main = 0 if ces04_cps_a8!=5 & ces04_cps_a8!=6
replace CA04_network_main = . if ces04_cps_a8 == 8
replace CA04_network_main = . if ces04_cps_a8 == 9


****************************************************
** DISTRICT-LEVEL OUTCOMES: 2006 FEDERAL ELECTION **
****************************************************

* Note: 1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 5 = GPC, 88 = independent

gen CA06_district_outcome = .

replace CA06_district_outcome = 2 if ces06_fed03 == 10001 
replace CA06_district_outcome = 1 if ces06_fed03 == 10002 
replace CA06_district_outcome = 1 if ces06_fed03 == 10003 
replace CA06_district_outcome = 1 if ces06_fed03 == 10004 
replace CA06_district_outcome = 1 if ces06_fed03 == 10005 
replace CA06_district_outcome = 2 if ces06_fed03 == 10006 
replace CA06_district_outcome = 2 if ces06_fed03 == 10007 
replace CA06_district_outcome = 1 if ces06_fed03 == 11001 
replace CA06_district_outcome = 1 if ces06_fed03 == 11002 
replace CA06_district_outcome = 1 if ces06_fed03 == 11003 
replace CA06_district_outcome = 1 if ces06_fed03 == 11004 
replace CA06_district_outcome = 1 if ces06_fed03 == 12001 
replace CA06_district_outcome = 2 if ces06_fed03 == 12002 
replace CA06_district_outcome = 1 if ces06_fed03 == 12003 
replace CA06_district_outcome = 3 if ces06_fed03 == 12004 
replace CA06_district_outcome = 1 if ces06_fed03 == 12005 
replace CA06_district_outcome = 1 if ces06_fed03 == 12006 
replace CA06_district_outcome = 2 if ces06_fed03 == 12007 
replace CA06_district_outcome = 3 if ces06_fed03 == 12008 
replace CA06_district_outcome = 2 if ces06_fed03 == 12009 
replace CA06_district_outcome = 1 if ces06_fed03 == 12010 
replace CA06_district_outcome = 1 if ces06_fed03 == 12011 
replace CA06_district_outcome = 3 if ces06_fed03 == 13001 
replace CA06_district_outcome = 1 if ces06_fed03 == 13002 
replace CA06_district_outcome = 1 if ces06_fed03 == 13003 
replace CA06_district_outcome = 2 if ces06_fed03 == 13004 
replace CA06_district_outcome = 1 if ces06_fed03 == 13005 
replace CA06_district_outcome = 1 if ces06_fed03 == 13006 
replace CA06_district_outcome = 1 if ces06_fed03 == 13007 
replace CA06_district_outcome = 2 if ces06_fed03 == 13008 
replace CA06_district_outcome = 1 if ces06_fed03 == 13009 
replace CA06_district_outcome = 1 if ces06_fed03 == 13010 
replace CA06_district_outcome = 4 if ces06_fed03 == 24001 
replace CA06_district_outcome = 4 if ces06_fed03 == 24002 
replace CA06_district_outcome = 4 if ces06_fed03 == 24003 
replace CA06_district_outcome = 4 if ces06_fed03 == 24004 
replace CA06_district_outcome = 2 if ces06_fed03 == 24005 
replace CA06_district_outcome = 4 if ces06_fed03 == 24006 
replace CA06_district_outcome = 2 if ces06_fed03 == 24007 
replace CA06_district_outcome = 4 if ces06_fed03 == 24008 
replace CA06_district_outcome = 1 if ces06_fed03 == 24009 
replace CA06_district_outcome = 4 if ces06_fed03 == 24010 
replace CA06_district_outcome = 4 if ces06_fed03 == 24011 
replace CA06_district_outcome = 4 if ces06_fed03 == 24012 
replace CA06_district_outcome = 2 if ces06_fed03 == 24013 
replace CA06_district_outcome = 4 if ces06_fed03 == 24014 
replace CA06_district_outcome = 4 if ces06_fed03 == 24015 
replace CA06_district_outcome = 4 if ces06_fed03 == 24016 
replace CA06_district_outcome = 2 if ces06_fed03 == 24017 
replace CA06_district_outcome = 4 if ces06_fed03 == 24018 
replace CA06_district_outcome = 4 if ces06_fed03 == 24019 
replace CA06_district_outcome = 4 if ces06_fed03 == 24020 
replace CA06_district_outcome = 4 if ces06_fed03 == 24021 
replace CA06_district_outcome = 1 if ces06_fed03 == 24022 
replace CA06_district_outcome = 1 if ces06_fed03 == 24023 
replace CA06_district_outcome = 4 if ces06_fed03 == 24024 
replace CA06_district_outcome = 4 if ces06_fed03 == 24025 
replace CA06_district_outcome = 2 if ces06_fed03 == 24026 
replace CA06_district_outcome = 1 if ces06_fed03 == 24027 
replace CA06_district_outcome = 4 if ces06_fed03 == 24028 
replace CA06_district_outcome = 1 if ces06_fed03 == 24029 
replace CA06_district_outcome = 4 if ces06_fed03 == 24030 
replace CA06_district_outcome = 4 if ces06_fed03 == 24031 
replace CA06_district_outcome = 4 if ces06_fed03 == 24032 
replace CA06_district_outcome = 1 if ces06_fed03 == 24033 
replace CA06_district_outcome = 2 if ces06_fed03 == 24034 
replace CA06_district_outcome = 4 if ces06_fed03 == 24035 
replace CA06_district_outcome = 2 if ces06_fed03 == 24036 
replace CA06_district_outcome = 2 if ces06_fed03 == 24037 
replace CA06_district_outcome = 2 if ces06_fed03 == 24038 
replace CA06_district_outcome = 4 if ces06_fed03 == 24039 
replace CA06_district_outcome = 4 if ces06_fed03 == 24040 
replace CA06_district_outcome = 4 if ces06_fed03 == 24041 
replace CA06_district_outcome = 2 if ces06_fed03 == 24042 
replace CA06_district_outcome = 4 if ces06_fed03 == 24043 
replace CA06_district_outcome = 1 if ces06_fed03 == 24044 
replace CA06_district_outcome = 1 if ces06_fed03 == 24045 
replace CA06_district_outcome = 4 if ces06_fed03 == 24046 
replace CA06_district_outcome = 1 if ces06_fed03 == 24047 
replace CA06_district_outcome = 4 if ces06_fed03 == 24048 
replace CA06_district_outcome = 1 if ces06_fed03 == 24049 
replace CA06_district_outcome = 2 if ces06_fed03 == 24050 
replace CA06_district_outcome = 88 if ces06_fed03 == 24051 
replace CA06_district_outcome = 4 if ces06_fed03 == 24052 
replace CA06_district_outcome = 4 if ces06_fed03 == 24053 
replace CA06_district_outcome = 4 if ces06_fed03 == 24054 
replace CA06_district_outcome = 4 if ces06_fed03 == 24055 
replace CA06_district_outcome = 4 if ces06_fed03 == 24056 
replace CA06_district_outcome = 4 if ces06_fed03 == 24057 
replace CA06_district_outcome = 4 if ces06_fed03 == 24058 
replace CA06_district_outcome = 4 if ces06_fed03 == 24059 
replace CA06_district_outcome = 4 if ces06_fed03 == 24060 
replace CA06_district_outcome = 4 if ces06_fed03 == 24061 
replace CA06_district_outcome = 4 if ces06_fed03 == 24062 
replace CA06_district_outcome = 4 if ces06_fed03 == 24063 
replace CA06_district_outcome = 4 if ces06_fed03 == 24064 
replace CA06_district_outcome = 4 if ces06_fed03 == 24065 
replace CA06_district_outcome = 1 if ces06_fed03 == 24066 
replace CA06_district_outcome = 1 if ces06_fed03 == 24067 
replace CA06_district_outcome = 4 if ces06_fed03 == 24068 
replace CA06_district_outcome = 4 if ces06_fed03 == 24069 
replace CA06_district_outcome = 4 if ces06_fed03 == 24070 
replace CA06_district_outcome = 4 if ces06_fed03 == 24071 
replace CA06_district_outcome = 4 if ces06_fed03 == 24072 
replace CA06_district_outcome = 4 if ces06_fed03 == 24073 
replace CA06_district_outcome = 4 if ces06_fed03 == 24074 
replace CA06_district_outcome = 1 if ces06_fed03 == 24075 
replace CA06_district_outcome = 1 if ces06_fed03 == 35001 
replace CA06_district_outcome = 1 if ces06_fed03 == 35002 
replace CA06_district_outcome = 2 if ces06_fed03 == 35003 
replace CA06_district_outcome = 2 if ces06_fed03 == 35004 
replace CA06_district_outcome = 1 if ces06_fed03 == 35005 
replace CA06_district_outcome = 1 if ces06_fed03 == 35006 
replace CA06_district_outcome = 1 if ces06_fed03 == 35007 
replace CA06_district_outcome = 1 if ces06_fed03 == 35008 
replace CA06_district_outcome = 1 if ces06_fed03 == 35009 
replace CA06_district_outcome = 2 if ces06_fed03 == 35010 
replace CA06_district_outcome = 2 if ces06_fed03 == 35011 
replace CA06_district_outcome = 2 if ces06_fed03 == 35012 
replace CA06_district_outcome = 2 if ces06_fed03 == 35013 
replace CA06_district_outcome = 2 if ces06_fed03 == 35014 
replace CA06_district_outcome = 1 if ces06_fed03 == 35015 
replace CA06_district_outcome = 1 if ces06_fed03 == 35016 
replace CA06_district_outcome = 1 if ces06_fed03 == 35017 
replace CA06_district_outcome = 2 if ces06_fed03 == 35018 
replace CA06_district_outcome = 1 if ces06_fed03 == 35019 
replace CA06_district_outcome = 2 if ces06_fed03 == 35020 
replace CA06_district_outcome = 2 if ces06_fed03 == 35021 
replace CA06_district_outcome = 1 if ces06_fed03 == 35022 
replace CA06_district_outcome = 1 if ces06_fed03 == 35023 
replace CA06_district_outcome = 1 if ces06_fed03 == 35024 
replace CA06_district_outcome = 2 if ces06_fed03 == 35025 
replace CA06_district_outcome = 2 if ces06_fed03 == 35026 
replace CA06_district_outcome = 1 if ces06_fed03 == 35027 
replace CA06_district_outcome = 2 if ces06_fed03 == 35028 
replace CA06_district_outcome = 2 if ces06_fed03 == 35029 
replace CA06_district_outcome = 2 if ces06_fed03 == 35030 
replace CA06_district_outcome = 3 if ces06_fed03 == 35031 
replace CA06_district_outcome = 3 if ces06_fed03 == 35032 
replace CA06_district_outcome = 3 if ces06_fed03 == 35033 
replace CA06_district_outcome = 1 if ces06_fed03 == 35034 
replace CA06_district_outcome = 1 if ces06_fed03 == 35035 
replace CA06_district_outcome = 1 if ces06_fed03 == 35036 
replace CA06_district_outcome = 1 if ces06_fed03 == 35037 
replace CA06_district_outcome = 2 if ces06_fed03 == 35038 
replace CA06_district_outcome = 1 if ces06_fed03 == 35039 
replace CA06_district_outcome = 2 if ces06_fed03 == 35040 
replace CA06_district_outcome = 2 if ces06_fed03 == 35041 
replace CA06_district_outcome = 3 if ces06_fed03 == 35042 
replace CA06_district_outcome = 1 if ces06_fed03 == 35043 
replace CA06_district_outcome = 1 if ces06_fed03 == 35044 
replace CA06_district_outcome = 1 if ces06_fed03 == 35045 
replace CA06_district_outcome = 2 if ces06_fed03 == 35046 
replace CA06_district_outcome = 1 if ces06_fed03 == 35047 
replace CA06_district_outcome = 1 if ces06_fed03 == 35048 
replace CA06_district_outcome = 1 if ces06_fed03 == 35049 
replace CA06_district_outcome = 1 if ces06_fed03 == 35050 
replace CA06_district_outcome = 1 if ces06_fed03 == 35051 
replace CA06_district_outcome = 2 if ces06_fed03 == 35052 
replace CA06_district_outcome = 1 if ces06_fed03 == 35053 
replace CA06_district_outcome = 2 if ces06_fed03 == 35054 
replace CA06_district_outcome = 2 if ces06_fed03 == 35055 
replace CA06_district_outcome = 1 if ces06_fed03 == 35056 
replace CA06_district_outcome = 1 if ces06_fed03 == 35057 
replace CA06_district_outcome = 2 if ces06_fed03 == 35058 
replace CA06_district_outcome = 1 if ces06_fed03 == 35059 
replace CA06_district_outcome = 1 if ces06_fed03 == 35060 
replace CA06_district_outcome = 2 if ces06_fed03 == 35061 
replace CA06_district_outcome = 3 if ces06_fed03 == 35062 
replace CA06_district_outcome = 2 if ces06_fed03 == 35063 
replace CA06_district_outcome = 1 if ces06_fed03 == 35064 
replace CA06_district_outcome = 1 if ces06_fed03 == 35065 
replace CA06_district_outcome = 2 if ces06_fed03 == 35066 
replace CA06_district_outcome = 2 if ces06_fed03 == 35067 
replace CA06_district_outcome = 3 if ces06_fed03 == 35068 
replace CA06_district_outcome = 2 if ces06_fed03 == 35069 
replace CA06_district_outcome = 2 if ces06_fed03 == 35070 
replace CA06_district_outcome = 2 if ces06_fed03 == 35071 
replace CA06_district_outcome = 1 if ces06_fed03 == 35072 
replace CA06_district_outcome = 2 if ces06_fed03 == 35073 
replace CA06_district_outcome = 2 if ces06_fed03 == 35074 
replace CA06_district_outcome = 1 if ces06_fed03 == 35075 
replace CA06_district_outcome = 2 if ces06_fed03 == 35076 
replace CA06_district_outcome = 1 if ces06_fed03 == 35077 
replace CA06_district_outcome = 2 if ces06_fed03 == 35078 
replace CA06_district_outcome = 3 if ces06_fed03 == 35079 
replace CA06_district_outcome = 1 if ces06_fed03 == 35080 
replace CA06_district_outcome = 1 if ces06_fed03 == 35081 
replace CA06_district_outcome = 1 if ces06_fed03 == 35082 
replace CA06_district_outcome = 1 if ces06_fed03 == 35083 
replace CA06_district_outcome = 1 if ces06_fed03 == 35084 
replace CA06_district_outcome = 2 if ces06_fed03 == 35085 
replace CA06_district_outcome = 2 if ces06_fed03 == 35086 
replace CA06_district_outcome = 2 if ces06_fed03 == 35087 
replace CA06_district_outcome = 1 if ces06_fed03 == 35088 
replace CA06_district_outcome = 1 if ces06_fed03 == 35089 
replace CA06_district_outcome = 1 if ces06_fed03 == 35090 
replace CA06_district_outcome = 1 if ces06_fed03 == 35091 
replace CA06_district_outcome = 3 if ces06_fed03 == 35092 
replace CA06_district_outcome = 1 if ces06_fed03 == 35093 
replace CA06_district_outcome = 3 if ces06_fed03 == 35094 
replace CA06_district_outcome = 3 if ces06_fed03 == 35095 
replace CA06_district_outcome = 1 if ces06_fed03 == 35096 
replace CA06_district_outcome = 1 if ces06_fed03 == 35097 
replace CA06_district_outcome = 2 if ces06_fed03 == 35098 
replace CA06_district_outcome = 2 if ces06_fed03 == 35099 
replace CA06_district_outcome = 1 if ces06_fed03 == 35100 
replace CA06_district_outcome = 3 if ces06_fed03 == 35101 
replace CA06_district_outcome = 3 if ces06_fed03 == 35102 
replace CA06_district_outcome = 1 if ces06_fed03 == 35103 
replace CA06_district_outcome = 2 if ces06_fed03 == 35104 
replace CA06_district_outcome = 1 if ces06_fed03 == 35105 
replace CA06_district_outcome = 1 if ces06_fed03 == 35106 
replace CA06_district_outcome = 2 if ces06_fed03 == 46001 
replace CA06_district_outcome = 2 if ces06_fed03 == 46002 
replace CA06_district_outcome = 1 if ces06_fed03 == 46003 
replace CA06_district_outcome = 2 if ces06_fed03 == 46004 
replace CA06_district_outcome = 3 if ces06_fed03 == 46005 
replace CA06_district_outcome = 2 if ces06_fed03 == 46006 
replace CA06_district_outcome = 2 if ces06_fed03 == 46007 
replace CA06_district_outcome = 2 if ces06_fed03 == 46008 
replace CA06_district_outcome = 1 if ces06_fed03 == 46009 
replace CA06_district_outcome = 2 if ces06_fed03 == 46010 
replace CA06_district_outcome = 3 if ces06_fed03 == 46011 
replace CA06_district_outcome = 3 if ces06_fed03 == 46012 
replace CA06_district_outcome = 2 if ces06_fed03 == 46013 
replace CA06_district_outcome = 1 if ces06_fed03 == 46014 
replace CA06_district_outcome = 2 if ces06_fed03 == 47001 
replace CA06_district_outcome = 2 if ces06_fed03 == 47002 
replace CA06_district_outcome = 1 if ces06_fed03 == 47003 
replace CA06_district_outcome = 2 if ces06_fed03 == 47004 
replace CA06_district_outcome = 2 if ces06_fed03 == 47005 
replace CA06_district_outcome = 2 if ces06_fed03 == 47006 
replace CA06_district_outcome = 2 if ces06_fed03 == 47007 
replace CA06_district_outcome = 2 if ces06_fed03 == 47008 
replace CA06_district_outcome = 2 if ces06_fed03 == 47009 
replace CA06_district_outcome = 2 if ces06_fed03 == 47010 
replace CA06_district_outcome = 2 if ces06_fed03 == 47011 
replace CA06_district_outcome = 2 if ces06_fed03 == 47012 
replace CA06_district_outcome = 1 if ces06_fed03 == 47013 
replace CA06_district_outcome = 2 if ces06_fed03 == 47014 
replace CA06_district_outcome = 2 if ces06_fed03 == 48001 
replace CA06_district_outcome = 2 if ces06_fed03 == 48002 
replace CA06_district_outcome = 2 if ces06_fed03 == 48003 
replace CA06_district_outcome = 2 if ces06_fed03 == 48004 
replace CA06_district_outcome = 2 if ces06_fed03 == 48005 
replace CA06_district_outcome = 2 if ces06_fed03 == 48006 
replace CA06_district_outcome = 2 if ces06_fed03 == 48007 
replace CA06_district_outcome = 2 if ces06_fed03 == 48008 
replace CA06_district_outcome = 2 if ces06_fed03 == 48009 
replace CA06_district_outcome = 2 if ces06_fed03 == 48010 
replace CA06_district_outcome = 2 if ces06_fed03 == 48011 
replace CA06_district_outcome = 2 if ces06_fed03 == 48012 
replace CA06_district_outcome = 2 if ces06_fed03 == 48013 
replace CA06_district_outcome = 2 if ces06_fed03 == 48014 
replace CA06_district_outcome = 2 if ces06_fed03 == 48015 
replace CA06_district_outcome = 2 if ces06_fed03 == 48016 
replace CA06_district_outcome = 2 if ces06_fed03 == 48017 
replace CA06_district_outcome = 2 if ces06_fed03 == 48018 
replace CA06_district_outcome = 2 if ces06_fed03 == 48019 
replace CA06_district_outcome = 2 if ces06_fed03 == 48020 
replace CA06_district_outcome = 2 if ces06_fed03 == 48021 
replace CA06_district_outcome = 2 if ces06_fed03 == 48022 
replace CA06_district_outcome = 2 if ces06_fed03 == 48023 
replace CA06_district_outcome = 2 if ces06_fed03 == 48024 
replace CA06_district_outcome = 2 if ces06_fed03 == 48025 
replace CA06_district_outcome = 2 if ces06_fed03 == 48026 
replace CA06_district_outcome = 2 if ces06_fed03 == 48027 
replace CA06_district_outcome = 2 if ces06_fed03 == 48028 
replace CA06_district_outcome = 2 if ces06_fed03 == 59001 
replace CA06_district_outcome = 3 if ces06_fed03 == 59002 
replace CA06_district_outcome = 3 if ces06_fed03 == 59003 
replace CA06_district_outcome = 2 if ces06_fed03 == 59004 
replace CA06_district_outcome = 2 if ces06_fed03 == 59005 
replace CA06_district_outcome = 2 if ces06_fed03 == 59006 
replace CA06_district_outcome = 2 if ces06_fed03 == 59007 
replace CA06_district_outcome = 1 if ces06_fed03 == 59008 
replace CA06_district_outcome = 2 if ces06_fed03 == 59009 
replace CA06_district_outcome = 2 if ces06_fed03 == 59010 
replace CA06_district_outcome = 1 if ces06_fed03 == 59011 
replace CA06_district_outcome = 2 if ces06_fed03 == 59012 
replace CA06_district_outcome = 2 if ces06_fed03 == 59013 
replace CA06_district_outcome = 2 if ces06_fed03 == 59014 
replace CA06_district_outcome = 3 if ces06_fed03 == 59015 
replace CA06_district_outcome = 1 if ces06_fed03 == 59016 
replace CA06_district_outcome = 3 if ces06_fed03 == 59017 
replace CA06_district_outcome = 2 if ces06_fed03 == 59018 
replace CA06_district_outcome = 1 if ces06_fed03 == 59019 
replace CA06_district_outcome = 2 if ces06_fed03 == 59020 
replace CA06_district_outcome = 2 if ces06_fed03 == 59021 
replace CA06_district_outcome = 2 if ces06_fed03 == 59022 
replace CA06_district_outcome = 1 if ces06_fed03 == 59023 
replace CA06_district_outcome = 2 if ces06_fed03 == 59024 
replace CA06_district_outcome = 3 if ces06_fed03 == 59025 
replace CA06_district_outcome = 3 if ces06_fed03 == 59026 
replace CA06_district_outcome = 2 if ces06_fed03 == 59027 
replace CA06_district_outcome = 3 if ces06_fed03 == 59028 
replace CA06_district_outcome = 1 if ces06_fed03 == 59029 
replace CA06_district_outcome = 3 if ces06_fed03 == 59030 
replace CA06_district_outcome = 3 if ces06_fed03 == 59031 
replace CA06_district_outcome = 1 if ces06_fed03 == 59032 
replace CA06_district_outcome = 1 if ces06_fed03 == 59033 
replace CA06_district_outcome = 1 if ces06_fed03 == 59034 
replace CA06_district_outcome = 3 if ces06_fed03 == 59035 
replace CA06_district_outcome = 1 if ces06_fed03 == 59036 
replace CA06_district_outcome = 1 if ces06_fed03 == 60001 
replace CA06_district_outcome = 3 if ces06_fed03 == 61001 
replace CA06_district_outcome = 1 if ces06_fed03 == 62001 


******************************************************
** INCUMBENT PARTY REELECTED: 2006 FEDERAL ELECTION **
******************************************************

gen CA06_reelected = .

replace CA06_reelected = 0 if ces06_fed03 == 10001 
replace CA06_reelected = 1 if ces06_fed03 == 10002 
replace CA06_reelected = 1 if ces06_fed03 == 10003 
replace CA06_reelected = 1 if ces06_fed03 == 10004 
replace CA06_reelected = 1 if ces06_fed03 == 10005 
replace CA06_reelected = 1 if ces06_fed03 == 10006 
replace CA06_reelected = 1 if ces06_fed03 == 10007 
replace CA06_reelected = 1 if ces06_fed03 == 11001 
replace CA06_reelected = 1 if ces06_fed03 == 11002 
replace CA06_reelected = 1 if ces06_fed03 == 11003 
replace CA06_reelected = 1 if ces06_fed03 == 11004 
replace CA06_reelected = 1 if ces06_fed03 == 12001 
replace CA06_reelected = 1 if ces06_fed03 == 12002 
replace CA06_reelected = 1 if ces06_fed03 == 12003 
replace CA06_reelected = 1 if ces06_fed03 == 12004 
replace CA06_reelected = 1 if ces06_fed03 == 12005 
replace CA06_reelected = 1 if ces06_fed03 == 12006 
replace CA06_reelected = 1 if ces06_fed03 == 12007 
replace CA06_reelected = 1 if ces06_fed03 == 12008 
replace CA06_reelected = 1 if ces06_fed03 == 12009 
replace CA06_reelected = 1 if ces06_fed03 == 12010 
replace CA06_reelected = 1 if ces06_fed03 == 12011 
replace CA06_reelected = 1 if ces06_fed03 == 13001 
replace CA06_reelected = 1 if ces06_fed03 == 13002 
replace CA06_reelected = 1 if ces06_fed03 == 13003 
replace CA06_reelected = 1 if ces06_fed03 == 13004 
replace CA06_reelected = 1 if ces06_fed03 == 13005 
replace CA06_reelected = 1 if ces06_fed03 == 13006 
replace CA06_reelected = 1 if ces06_fed03 == 13007 
replace CA06_reelected = 1 if ces06_fed03 == 13008 
replace CA06_reelected = 1 if ces06_fed03 == 13009 
replace CA06_reelected = 1 if ces06_fed03 == 13010 
replace CA06_reelected = 1 if ces06_fed03 == 24001 
replace CA06_reelected = 0 if ces06_fed03 == 24002 
replace CA06_reelected = 1 if ces06_fed03 == 24003 
replace CA06_reelected = 1 if ces06_fed03 == 24004 
replace CA06_reelected = 0 if ces06_fed03 == 24005 
replace CA06_reelected = 1 if ces06_fed03 == 24006 
replace CA06_reelected = 0 if ces06_fed03 == 24007 
replace CA06_reelected = 1 if ces06_fed03 == 24008 
replace CA06_reelected = 1 if ces06_fed03 == 24009 
replace CA06_reelected = 0 if ces06_fed03 == 24010 
replace CA06_reelected = 0 if ces06_fed03 == 24011 
replace CA06_reelected = 1 if ces06_fed03 == 24012 
replace CA06_reelected = 0 if ces06_fed03 == 24013 
replace CA06_reelected = 1 if ces06_fed03 == 24014 
replace CA06_reelected = 1 if ces06_fed03 == 24015 
replace CA06_reelected = 1 if ces06_fed03 == 24016 
replace CA06_reelected = 0 if ces06_fed03 == 24017 
replace CA06_reelected = 1 if ces06_fed03 == 24018 
replace CA06_reelected = 1 if ces06_fed03 == 24019 
replace CA06_reelected = 0 if ces06_fed03 == 24020 
replace CA06_reelected = 1 if ces06_fed03 == 24021 
replace CA06_reelected = 1 if ces06_fed03 == 24022 
replace CA06_reelected = 1 if ces06_fed03 == 24023 
replace CA06_reelected = 0 if ces06_fed03 == 24024 
replace CA06_reelected = 1 if ces06_fed03 == 24025 
replace CA06_reelected = 0 if ces06_fed03 == 24026 
replace CA06_reelected = 1 if ces06_fed03 == 24027 
replace CA06_reelected = 1 if ces06_fed03 == 24028 
replace CA06_reelected = 1 if ces06_fed03 == 24029 
replace CA06_reelected = 1 if ces06_fed03 == 24030 
replace CA06_reelected = 1 if ces06_fed03 == 24031 
replace CA06_reelected = 1 if ces06_fed03 == 24032 
replace CA06_reelected = 1 if ces06_fed03 == 24033 
replace CA06_reelected = 0 if ces06_fed03 == 24034 
replace CA06_reelected = 1 if ces06_fed03 == 24035 
replace CA06_reelected = 0 if ces06_fed03 == 24036 
replace CA06_reelected = 0 if ces06_fed03 == 24037 
replace CA06_reelected = 0 if ces06_fed03 == 24038 
replace CA06_reelected = 1 if ces06_fed03 == 24039 
replace CA06_reelected = 1 if ces06_fed03 == 24040 
replace CA06_reelected = 1 if ces06_fed03 == 24041 
replace CA06_reelected = 0 if ces06_fed03 == 24042 
replace CA06_reelected = 1 if ces06_fed03 == 24043 
replace CA06_reelected = 1 if ces06_fed03 == 24044 
replace CA06_reelected = 1 if ces06_fed03 == 24045 
replace CA06_reelected = 1 if ces06_fed03 == 24046 
replace CA06_reelected = 1 if ces06_fed03 == 24047 
replace CA06_reelected = 0 if ces06_fed03 == 24048 
replace CA06_reelected = 1 if ces06_fed03 == 24049 
replace CA06_reelected = 0 if ces06_fed03 == 24050 
replace CA06_reelected = 0 if ces06_fed03 == 24051 
replace CA06_reelected = 1 if ces06_fed03 == 24052 
replace CA06_reelected = 1 if ces06_fed03 == 24053 
replace CA06_reelected = 1 if ces06_fed03 == 24054 
replace CA06_reelected = 1 if ces06_fed03 == 24055 
replace CA06_reelected = 1 if ces06_fed03 == 24056 
replace CA06_reelected = 1 if ces06_fed03 == 24057 
replace CA06_reelected = 1 if ces06_fed03 == 24058 
replace CA06_reelected = 1 if ces06_fed03 == 24059 
replace CA06_reelected = 1 if ces06_fed03 == 24060 
replace CA06_reelected = 1 if ces06_fed03 == 24061 
replace CA06_reelected = 1 if ces06_fed03 == 24062 
replace CA06_reelected = 1 if ces06_fed03 == 24063 
replace CA06_reelected = 1 if ces06_fed03 == 24064 
replace CA06_reelected = 1 if ces06_fed03 == 24065 
replace CA06_reelected = 1 if ces06_fed03 == 24066 
replace CA06_reelected = 1 if ces06_fed03 == 24067 
replace CA06_reelected = 1 if ces06_fed03 == 24068 
replace CA06_reelected = 1 if ces06_fed03 == 24069 
replace CA06_reelected = 1 if ces06_fed03 == 24070 
replace CA06_reelected = 1 if ces06_fed03 == 24071 
replace CA06_reelected = 1 if ces06_fed03 == 24072 
replace CA06_reelected = 1 if ces06_fed03 == 24073 
replace CA06_reelected = 1 if ces06_fed03 == 24074 
replace CA06_reelected = 1 if ces06_fed03 == 24075 
replace CA06_reelected = 1 if ces06_fed03 == 35001 
replace CA06_reelected = 1 if ces06_fed03 == 35002 
replace CA06_reelected = 0 if ces06_fed03 == 35003 
replace CA06_reelected = 0 if ces06_fed03 == 35004 
replace CA06_reelected = 1 if ces06_fed03 == 35005 
replace CA06_reelected = 1 if ces06_fed03 == 35006 
replace CA06_reelected = 1 if ces06_fed03 == 35007 
replace CA06_reelected = 1 if ces06_fed03 == 35008 
replace CA06_reelected = 1 if ces06_fed03 == 35009 
replace CA06_reelected = 0 if ces06_fed03 == 35010 
replace CA06_reelected = 1 if ces06_fed03 == 35011 
replace CA06_reelected = 1 if ces06_fed03 == 35012 
replace CA06_reelected = 0 if ces06_fed03 == 35013 
replace CA06_reelected = 1 if ces06_fed03 == 35014 
replace CA06_reelected = 1 if ces06_fed03 == 35015 
replace CA06_reelected = 1 if ces06_fed03 == 35016 
replace CA06_reelected = 1 if ces06_fed03 == 35017 
replace CA06_reelected = 1 if ces06_fed03 == 35018 
replace CA06_reelected = 1 if ces06_fed03 == 35019 
replace CA06_reelected = 1 if ces06_fed03 == 35020 
replace CA06_reelected = 1 if ces06_fed03 == 35021 
replace CA06_reelected = 1 if ces06_fed03 == 35022 
replace CA06_reelected = 1 if ces06_fed03 == 35023 
replace CA06_reelected = 1 if ces06_fed03 == 35024 
replace CA06_reelected = 0 if ces06_fed03 == 35025 
replace CA06_reelected = 1 if ces06_fed03 == 35026 
replace CA06_reelected = 1 if ces06_fed03 == 35027 
replace CA06_reelected = 1 if ces06_fed03 == 35028 
replace CA06_reelected = 1 if ces06_fed03 == 35029 
replace CA06_reelected = 0 if ces06_fed03 == 35030 
replace CA06_reelected = 1 if ces06_fed03 == 35031 
replace CA06_reelected = 0 if ces06_fed03 == 35032 
replace CA06_reelected = 0 if ces06_fed03 == 35033 
replace CA06_reelected = 1 if ces06_fed03 == 35034 
replace CA06_reelected = 1 if ces06_fed03 == 35035 
replace CA06_reelected = 1 if ces06_fed03 == 35036 
replace CA06_reelected = 1 if ces06_fed03 == 35037 
replace CA06_reelected = 0 if ces06_fed03 == 35038 
replace CA06_reelected = 1 if ces06_fed03 == 35039 
replace CA06_reelected = 1 if ces06_fed03 == 35040 
replace CA06_reelected = 1 if ces06_fed03 == 35041 
replace CA06_reelected = 0 if ces06_fed03 == 35042 
replace CA06_reelected = 1 if ces06_fed03 == 35043 
replace CA06_reelected = 1 if ces06_fed03 == 35044 
replace CA06_reelected = 1 if ces06_fed03 == 35045 
replace CA06_reelected = 0 if ces06_fed03 == 35046 
replace CA06_reelected = 1 if ces06_fed03 == 35047 
replace CA06_reelected = 1 if ces06_fed03 == 35048 
replace CA06_reelected = 1 if ces06_fed03 == 35049 
replace CA06_reelected = 1 if ces06_fed03 == 35050 
replace CA06_reelected = 1 if ces06_fed03 == 35051 
replace CA06_reelected = 1 if ces06_fed03 == 35052 
replace CA06_reelected = 0 if ces06_fed03 == 35053 
replace CA06_reelected = 1 if ces06_fed03 == 35054 
replace CA06_reelected = 1 if ces06_fed03 == 35055 
replace CA06_reelected = 1 if ces06_fed03 == 35056 
replace CA06_reelected = 1 if ces06_fed03 == 35057 
replace CA06_reelected = 0 if ces06_fed03 == 35058 
replace CA06_reelected = 1 if ces06_fed03 == 35059 
replace CA06_reelected = 1 if ces06_fed03 == 35060 
replace CA06_reelected = 1 if ces06_fed03 == 35061 
replace CA06_reelected = 1 if ces06_fed03 == 35062 
replace CA06_reelected = 0 if ces06_fed03 == 35063 
replace CA06_reelected = 1 if ces06_fed03 == 35064 
replace CA06_reelected = 1 if ces06_fed03 == 35065 
replace CA06_reelected = 0 if ces06_fed03 == 35066 
replace CA06_reelected = 1 if ces06_fed03 == 35067 
replace CA06_reelected = 0 if ces06_fed03 == 35068 
replace CA06_reelected = 0 if ces06_fed03 == 35069 
replace CA06_reelected = 1 if ces06_fed03 == 35070 
replace CA06_reelected = 0 if ces06_fed03 == 35071 
replace CA06_reelected = 1 if ces06_fed03 == 35072 
replace CA06_reelected = 1 if ces06_fed03 == 35073 
replace CA06_reelected = 1 if ces06_fed03 == 35074 
replace CA06_reelected = 1 if ces06_fed03 == 35075 
replace CA06_reelected = 0 if ces06_fed03 == 35076 
replace CA06_reelected = 1 if ces06_fed03 == 35077 
replace CA06_reelected = 0 if ces06_fed03 == 35078 
replace CA06_reelected = 1 if ces06_fed03 == 35079 
replace CA06_reelected = 1 if ces06_fed03 == 35080 
replace CA06_reelected = 1 if ces06_fed03 == 35081 
replace CA06_reelected = 1 if ces06_fed03 == 35082 
replace CA06_reelected = 1 if ces06_fed03 == 35083 
replace CA06_reelected = 1 if ces06_fed03 == 35084 
replace CA06_reelected = 1 if ces06_fed03 == 35085 
replace CA06_reelected = 0 if ces06_fed03 == 35086 
replace CA06_reelected = 1 if ces06_fed03 == 35087 
replace CA06_reelected = 1 if ces06_fed03 == 35088 
replace CA06_reelected = 1 if ces06_fed03 == 35089 
replace CA06_reelected = 1 if ces06_fed03 == 35090 
replace CA06_reelected = 1 if ces06_fed03 == 35091 
replace CA06_reelected = 1 if ces06_fed03 == 35092 
replace CA06_reelected = 1 if ces06_fed03 == 35093 
replace CA06_reelected = 1 if ces06_fed03 == 35094 
replace CA06_reelected = 0 if ces06_fed03 == 35095 
replace CA06_reelected = 1 if ces06_fed03 == 35096 
replace CA06_reelected = 1 if ces06_fed03 == 35097 
replace CA06_reelected = 1 if ces06_fed03 == 35098 
replace CA06_reelected = 0 if ces06_fed03 == 35099 
replace CA06_reelected = 1 if ces06_fed03 == 35100 
replace CA06_reelected = 1 if ces06_fed03 == 35101 
replace CA06_reelected = 1 if ces06_fed03 == 35102 
replace CA06_reelected = 1 if ces06_fed03 == 35103 
replace CA06_reelected = 1 if ces06_fed03 == 35104 
replace CA06_reelected = 1 if ces06_fed03 == 35105 
replace CA06_reelected = 1 if ces06_fed03 == 35106 
replace CA06_reelected = 1 if ces06_fed03 == 46001 
replace CA06_reelected = 1 if ces06_fed03 == 46002 
replace CA06_reelected = 0 if ces06_fed03 == 46003 
replace CA06_reelected = 1 if ces06_fed03 == 46004 
replace CA06_reelected = 1 if ces06_fed03 == 46005 
replace CA06_reelected = 1 if ces06_fed03 == 46006 
replace CA06_reelected = 1 if ces06_fed03 == 46007 
replace CA06_reelected = 1 if ces06_fed03 == 46008 
replace CA06_reelected = 1 if ces06_fed03 == 46009 
replace CA06_reelected = 1 if ces06_fed03 == 46010 
replace CA06_reelected = 1 if ces06_fed03 == 46011 
replace CA06_reelected = 1 if ces06_fed03 == 46012 
replace CA06_reelected = 0 if ces06_fed03 == 46013 
replace CA06_reelected = 1 if ces06_fed03 == 46014 
replace CA06_reelected = 1 if ces06_fed03 == 47001 
replace CA06_reelected = 1 if ces06_fed03 == 47002 
replace CA06_reelected = 0 if ces06_fed03 == 47003 
replace CA06_reelected = 1 if ces06_fed03 == 47004 
replace CA06_reelected = 1 if ces06_fed03 == 47005 
replace CA06_reelected = 1 if ces06_fed03 == 47006 
replace CA06_reelected = 1 if ces06_fed03 == 47007 
replace CA06_reelected = 1 if ces06_fed03 == 47008 
replace CA06_reelected = 1 if ces06_fed03 == 47009 
replace CA06_reelected = 1 if ces06_fed03 == 47010 
replace CA06_reelected = 1 if ces06_fed03 == 47011 
replace CA06_reelected = 1 if ces06_fed03 == 47012 
replace CA06_reelected = 1 if ces06_fed03 == 47013 
replace CA06_reelected = 1 if ces06_fed03 == 47014 
replace CA06_reelected = 1 if ces06_fed03 == 48001 
replace CA06_reelected = 1 if ces06_fed03 == 48002 
replace CA06_reelected = 1 if ces06_fed03 == 48003 
replace CA06_reelected = 1 if ces06_fed03 == 48004 
replace CA06_reelected = 1 if ces06_fed03 == 48005 
replace CA06_reelected = 1 if ces06_fed03 == 48006 
replace CA06_reelected = 1 if ces06_fed03 == 48007 
replace CA06_reelected = 1 if ces06_fed03 == 48008 
replace CA06_reelected = 1 if ces06_fed03 == 48009 
replace CA06_reelected = 1 if ces06_fed03 == 48010 
replace CA06_reelected = 0 if ces06_fed03 == 48011 
replace CA06_reelected = 0 if ces06_fed03 == 48012 
replace CA06_reelected = 1 if ces06_fed03 == 48013 
replace CA06_reelected = 1 if ces06_fed03 == 48014 
replace CA06_reelected = 1 if ces06_fed03 == 48015 
replace CA06_reelected = 1 if ces06_fed03 == 48016 
replace CA06_reelected = 1 if ces06_fed03 == 48017 
replace CA06_reelected = 1 if ces06_fed03 == 48018 
replace CA06_reelected = 1 if ces06_fed03 == 48019 
replace CA06_reelected = 1 if ces06_fed03 == 48020 
replace CA06_reelected = 1 if ces06_fed03 == 48021 
replace CA06_reelected = 1 if ces06_fed03 == 48022 
replace CA06_reelected = 1 if ces06_fed03 == 48023 
replace CA06_reelected = 1 if ces06_fed03 == 48024 
replace CA06_reelected = 1 if ces06_fed03 == 48025 
replace CA06_reelected = 1 if ces06_fed03 == 48026 
replace CA06_reelected = 1 if ces06_fed03 == 48027 
replace CA06_reelected = 1 if ces06_fed03 == 48028 
replace CA06_reelected = 1 if ces06_fed03 == 59001 
replace CA06_reelected = 1 if ces06_fed03 == 59002 
replace CA06_reelected = 1 if ces06_fed03 == 59003 
replace CA06_reelected = 1 if ces06_fed03 == 59004 
replace CA06_reelected = 1 if ces06_fed03 == 59005 
replace CA06_reelected = 1 if ces06_fed03 == 59006 
replace CA06_reelected = 1 if ces06_fed03 == 59007 
replace CA06_reelected = 1 if ces06_fed03 == 59008 
replace CA06_reelected = 1 if ces06_fed03 == 59009 
replace CA06_reelected = 1 if ces06_fed03 == 59010 
replace CA06_reelected = 0 if ces06_fed03 == 59011 
replace CA06_reelected = 1 if ces06_fed03 == 59012 
replace CA06_reelected = 1 if ces06_fed03 == 59013 
replace CA06_reelected = 1 if ces06_fed03 == 59014 
replace CA06_reelected = 1 if ces06_fed03 == 59015 
replace CA06_reelected = 0 if ces06_fed03 == 59016 
replace CA06_reelected = 0 if ces06_fed03 == 59017 
replace CA06_reelected = 1 if ces06_fed03 == 59018 
replace CA06_reelected = 1 if ces06_fed03 == 59019 
replace CA06_reelected = 1 if ces06_fed03 == 59020 
replace CA06_reelected = 1 if ces06_fed03 == 59021 
replace CA06_reelected = 1 if ces06_fed03 == 59022 
replace CA06_reelected = 1 if ces06_fed03 == 59023 
replace CA06_reelected = 1 if ces06_fed03 == 59024 
replace CA06_reelected = 1 if ces06_fed03 == 59025 
replace CA06_reelected = 0 if ces06_fed03 == 59026 
replace CA06_reelected = 1 if ces06_fed03 == 59027 
replace CA06_reelected = 0 if ces06_fed03 == 59028 
replace CA06_reelected = 1 if ces06_fed03 == 59029 
replace CA06_reelected = 1 if ces06_fed03 == 59030 
replace CA06_reelected = 0 if ces06_fed03 == 59031 
replace CA06_reelected = 1 if ces06_fed03 == 59032 
replace CA06_reelected = 1 if ces06_fed03 == 59033 
replace CA06_reelected = 1 if ces06_fed03 == 59034 
replace CA06_reelected = 0 if ces06_fed03 == 59035 
replace CA06_reelected = 0 if ces06_fed03 == 59036 
replace CA06_reelected = 1 if ces06_fed03 == 60001 
replace CA06_reelected = 0 if ces06_fed03 == 61001 
replace CA06_reelected = 1 if ces06_fed03 == 62001 


********************************************
** COMPETITIVENESS: 2006 FEDERAL ELECTION **
********************************************

* Margin of victory

gen CA06_margin = .

replace CA06_margin = 12.97 if ces06_fed03 == 10001 
replace CA06_margin = 11.76 if ces06_fed03 == 10002 
replace CA06_margin = 21.74 if ces06_fed03 == 10003 
replace CA06_margin = 10.86 if ces06_fed03 == 10004 
replace CA06_margin = 4.73 if ces06_fed03 == 10005 
replace CA06_margin = 11.61 if ces06_fed03 == 10006 
replace CA06_margin = 11.68 if ces06_fed03 == 10007 
replace CA06_margin = 22.49 if ces06_fed03 == 11001 
replace CA06_margin = 16.02 if ces06_fed03 == 11002 
replace CA06_margin = 22.21 if ces06_fed03 == 11003 
replace CA06_margin = 15.85 if ces06_fed03 == 11004 
replace CA06_margin = 29.01 if ces06_fed03 == 12001 
replace CA06_margin = 7.77 if ces06_fed03 == 12002 
replace CA06_margin = 9.82 if ces06_fed03 == 12003 
replace CA06_margin = 28.88 if ces06_fed03 == 12004 
replace CA06_margin = 24.93 if ces06_fed03 == 12005 
replace CA06_margin = 13.37 if ces06_fed03 == 12006 
replace CA06_margin = 28.15 if ces06_fed03 == 12007 
replace CA06_margin = 29.96 if ces06_fed03 == 12008 
replace CA06_margin = 8.34 if ces06_fed03 == 12009 
replace CA06_margin = 21.38 if ces06_fed03 == 12010 
replace CA06_margin = 1.13 if ces06_fed03 == 12011 
replace CA06_margin = 19.19 if ces06_fed03 == 13001 
replace CA06_margin = 15.32 if ces06_fed03 == 13002 
replace CA06_margin = 7.14 if ces06_fed03 == 13003 
replace CA06_margin = 20.97 if ces06_fed03 == 13004 
replace CA06_margin = 2.45 if ces06_fed03 == 13005 
replace CA06_margin = 8.20 if ces06_fed03 == 13006 
replace CA06_margin = 17.60 if ces06_fed03 == 13007 
replace CA06_margin = 28.01 if ces06_fed03 == 13008 
replace CA06_margin = 3.62 if ces06_fed03 == 13009 
replace CA06_margin = 31.37 if ces06_fed03 == 13010 
replace CA06_margin = 29.75 if ces06_fed03 == 24001 
replace CA06_margin = 1.67 if ces06_fed03 == 24002 
replace CA06_margin = 15.38 if ces06_fed03 == 24003 
replace CA06_margin = 28.81 if ces06_fed03 == 24004 
replace CA06_margin = 47.05 if ces06_fed03 == 24005 
replace CA06_margin = 21.02 if ces06_fed03 == 24006 
replace CA06_margin = 1.67 if ces06_fed03 == 24007 
replace CA06_margin = 17.10 if ces06_fed03 == 24008 
replace CA06_margin = 11.44 if ces06_fed03 == 24009 
replace CA06_margin = 10.36 if ces06_fed03 == 24010 
replace CA06_margin = 2.16 if ces06_fed03 == 24011 
replace CA06_margin = 34.08 if ces06_fed03 == 24012 
replace CA06_margin = 2.76 if ces06_fed03 == 24013 
replace CA06_margin = 16.86 if ces06_fed03 == 24014 
replace CA06_margin = 30.99 if ces06_fed03 == 24015 
replace CA06_margin = 9.30 if ces06_fed03 == 24016 
replace CA06_margin = 2.02 if ces06_fed03 == 24017 
replace CA06_margin = 27.39 if ces06_fed03 == 24018 
replace CA06_margin = 10.46 if ces06_fed03 == 24019 
replace CA06_margin = 7.94 if ces06_fed03 == 24020 
replace CA06_margin = 38.34 if ces06_fed03 == 24021 
replace CA06_margin = 3.40 if ces06_fed03 == 24022 
replace CA06_margin = 3.32 if ces06_fed03 == 24023 
replace CA06_margin = 6.16 if ces06_fed03 == 24024 
replace CA06_margin = 27.29 if ces06_fed03 == 24025 
replace CA06_margin = 12.79 if ces06_fed03 == 24026 
replace CA06_margin = 21.51 if ces06_fed03 == 24027 
replace CA06_margin = 45.22 if ces06_fed03 == 24028 
replace CA06_margin = 19.68 if ces06_fed03 == 24029 
replace CA06_margin = 33.47 if ces06_fed03 == 24030 
replace CA06_margin = 38.01 if ces06_fed03 == 24031 
replace CA06_margin = 18.79 if ces06_fed03 == 24032 
replace CA06_margin = 6.25 if ces06_fed03 == 24033 
replace CA06_margin = 17.38 if ces06_fed03 == 24034 
replace CA06_margin = 36.42 if ces06_fed03 == 24035 
replace CA06_margin = 24.70 if ces06_fed03 == 24036 
replace CA06_margin = 0.39 if ces06_fed03 == 24037 
replace CA06_margin = 33.49 if ces06_fed03 == 24038 
replace CA06_margin = 32.12 if ces06_fed03 == 24039 
replace CA06_margin = 30.52 if ces06_fed03 == 24040 
replace CA06_margin = 16.29 if ces06_fed03 == 24041 
replace CA06_margin = 17.23 if ces06_fed03 == 24042 
replace CA06_margin = 43.02 if ces06_fed03 == 24043 
replace CA06_margin = 47.65 if ces06_fed03 == 24044 
replace CA06_margin = 23.51 if ces06_fed03 == 24045 
replace CA06_margin = 24.17 if ces06_fed03 == 24046 
replace CA06_margin = 6.17 if ces06_fed03 == 24047 
replace CA06_margin = 2.27 if ces06_fed03 == 24048 
replace CA06_margin = 28.04 if ces06_fed03 == 24049 
replace CA06_margin = 9.45 if ces06_fed03 == 24050 
replace CA06_margin = 13.96 if ces06_fed03 == 24051 
replace CA06_margin = 11.76 if ces06_fed03 == 24052 
replace CA06_margin = 44.34 if ces06_fed03 == 24053 
replace CA06_margin = 32.56 if ces06_fed03 == 24054 
replace CA06_margin = 15.66 if ces06_fed03 == 24055 
replace CA06_margin = 24.18 if ces06_fed03 == 24056 
replace CA06_margin = 33.03 if ces06_fed03 == 24057 
replace CA06_margin = 27.37 if ces06_fed03 == 24058 
replace CA06_margin = 38.31 if ces06_fed03 == 24059 
replace CA06_margin = 8.02 if ces06_fed03 == 24060 
replace CA06_margin = 40.23 if ces06_fed03 == 24061 
replace CA06_margin = 30.46 if ces06_fed03 == 24062 
replace CA06_margin = 31.22 if ces06_fed03 == 24063 
replace CA06_margin = 31.84 if ces06_fed03 == 24064 
replace CA06_margin = 21.99 if ces06_fed03 == 24065 
replace CA06_margin = 45.27 if ces06_fed03 == 24066 
replace CA06_margin = 38.43 if ces06_fed03 == 24067 
replace CA06_margin = 11.33 if ces06_fed03 == 24068 
replace CA06_margin = 18.33 if ces06_fed03 == 24069 
replace CA06_margin = 31.48 if ces06_fed03 == 24070 
replace CA06_margin = 39.16 if ces06_fed03 == 24071 
replace CA06_margin = 14.19 if ces06_fed03 == 24072 
replace CA06_margin = 14.64 if ces06_fed03 == 24073 
replace CA06_margin = 35.64 if ces06_fed03 == 24074 
replace CA06_margin = 28.03 if ces06_fed03 == 24075 
replace CA06_margin = 16.65 if ces06_fed03 == 35001 
replace CA06_margin = 3.67 if ces06_fed03 == 35002 
replace CA06_margin = 4.59 if ces06_fed03 == 35003 
replace CA06_margin = 2.70 if ces06_fed03 == 35004 
replace CA06_margin = 5.43 if ces06_fed03 == 35005 
replace CA06_margin = 17.95 if ces06_fed03 == 35006 
replace CA06_margin = 16.57 if ces06_fed03 == 35007 
replace CA06_margin = 13.42 if ces06_fed03 == 35008 
replace CA06_margin = 0.98 if ces06_fed03 == 35009 
replace CA06_margin = 4.00 if ces06_fed03 == 35010 
replace CA06_margin = 10.24 if ces06_fed03 == 35011 
replace CA06_margin = 32.62 if ces06_fed03 == 35012 
replace CA06_margin = 11.55 if ces06_fed03 == 35013 
replace CA06_margin = 17.01 if ces06_fed03 == 35014 
replace CA06_margin = 19.26 if ces06_fed03 == 35015 
replace CA06_margin = 24.84 if ces06_fed03 == 35016 
replace CA06_margin = 20.07 if ces06_fed03 == 35017 
replace CA06_margin = 17.97 if ces06_fed03 == 35018 
replace CA06_margin = 22.64 if ces06_fed03 == 35019 
replace CA06_margin = 19.28 if ces06_fed03 == 35020 
replace CA06_margin = 6.32 if ces06_fed03 == 35021 
replace CA06_margin = 19.20 if ces06_fed03 == 35022 
replace CA06_margin = 8.47 if ces06_fed03 == 35023 
replace CA06_margin = 39.27 if ces06_fed03 == 35024 
replace CA06_margin = 0.37 if ces06_fed03 == 35025 
replace CA06_margin = 20.62 if ces06_fed03 == 35026 
replace CA06_margin = 8.63 if ces06_fed03 == 35027 
replace CA06_margin = 14.04 if ces06_fed03 == 35028 
replace CA06_margin = 20.25 if ces06_fed03 == 35029 
replace CA06_margin = 2.74 if ces06_fed03 == 35030 
replace CA06_margin = 27.80 if ces06_fed03 == 35031 
replace CA06_margin = 0.87 if ces06_fed03 == 35032 
replace CA06_margin = 5.56 if ces06_fed03 == 35033 
replace CA06_margin = 1.82 if ces06_fed03 == 35034 
replace CA06_margin = 5.53 if ces06_fed03 == 35035 
replace CA06_margin = 19.79 if ces06_fed03 == 35036 
replace CA06_margin = 11.12 if ces06_fed03 == 35037 
replace CA06_margin = 2.74 if ces06_fed03 == 35038 
replace CA06_margin = 18.54 if ces06_fed03 == 35039 
replace CA06_margin = 26.33 if ces06_fed03 == 35040 
replace CA06_margin = 30.33 if ces06_fed03 == 35041 
replace CA06_margin = 1.87 if ces06_fed03 == 35042 
replace CA06_margin = 10.22 if ces06_fed03 == 35043 
replace CA06_margin = 2.17 if ces06_fed03 == 35044 
replace CA06_margin = 35.16 if ces06_fed03 == 35045 
replace CA06_margin = 29.17 if ces06_fed03 == 35046 
replace CA06_margin = 23.19 if ces06_fed03 == 35047 
replace CA06_margin = 20.20 if ces06_fed03 == 35048 
replace CA06_margin = 5.55 if ces06_fed03 == 35049 
replace CA06_margin = 4.08 if ces06_fed03 == 35050 
replace CA06_margin = 11.13 if ces06_fed03 == 35051 
replace CA06_margin = 26.99 if ces06_fed03 == 35052 
replace CA06_margin = 8.16 if ces06_fed03 == 35053 
replace CA06_margin = 5.83 if ces06_fed03 == 35054 
replace CA06_margin = 16.70 if ces06_fed03 == 35055 
replace CA06_margin = 4.61 if ces06_fed03 == 35056 
replace CA06_margin = 10.20 if ces06_fed03 == 35057 
replace CA06_margin = 5.21 if ces06_fed03 == 35058 
replace CA06_margin = 8.59 if ces06_fed03 == 35059 
replace CA06_margin = 1.25 if ces06_fed03 == 35060 
replace CA06_margin = 5.14 if ces06_fed03 == 35061 
replace CA06_margin = 7.72 if ces06_fed03 == 35062 
replace CA06_margin = 1.98 if ces06_fed03 == 35063 
replace CA06_margin = 6.71 if ces06_fed03 == 35064 
replace CA06_margin = 13.64 if ces06_fed03 == 35065 
replace CA06_margin = 9.01 if ces06_fed03 == 35066 
replace CA06_margin = 29.17 if ces06_fed03 == 35067 
replace CA06_margin = 4.47 if ces06_fed03 == 35068 
replace CA06_margin = 0.06 if ces06_fed03 == 35069 
replace CA06_margin = 20.35 if ces06_fed03 == 35070 
replace CA06_margin = 3.53 if ces06_fed03 == 35071 
replace CA06_margin = 20.95 if ces06_fed03 == 35072 
replace CA06_margin = 17.09 if ces06_fed03 == 35073 
replace CA06_margin = 33.53 if ces06_fed03 == 35074 
replace CA06_margin = 21.70 if ces06_fed03 == 35075 
replace CA06_margin = 0.42 if ces06_fed03 == 35076 
replace CA06_margin = 24.49 if ces06_fed03 == 35077 
replace CA06_margin = 7.87 if ces06_fed03 == 35078 
replace CA06_margin = 4.66 if ces06_fed03 == 35079 
replace CA06_margin = 38.76 if ces06_fed03 == 35080 
replace CA06_margin = 28.03 if ces06_fed03 == 35081 
replace CA06_margin = 24.56 if ces06_fed03 == 35082 
replace CA06_margin = 45.18 if ces06_fed03 == 35083 
replace CA06_margin = 23.79 if ces06_fed03 == 35084 
replace CA06_margin = 18.90 if ces06_fed03 == 35085 
replace CA06_margin = 2.06 if ces06_fed03 == 35086 
replace CA06_margin = 27.56 if ces06_fed03 == 35087 
replace CA06_margin = 9.62 if ces06_fed03 == 35088 
replace CA06_margin = 19.39 if ces06_fed03 == 35089 
replace CA06_margin = 1.71 if ces06_fed03 == 35090 
replace CA06_margin = 1.05 if ces06_fed03 == 35091 
replace CA06_margin = 16.32 if ces06_fed03 == 35092 
replace CA06_margin = 28.49 if ces06_fed03 == 35093 
replace CA06_margin = 14.19 if ces06_fed03 == 35094 
replace CA06_margin = 5.89 if ces06_fed03 == 35095 
replace CA06_margin = 33.67 if ces06_fed03 == 35096 
replace CA06_margin = 4.87 if ces06_fed03 == 35097 
replace CA06_margin = 21.50 if ces06_fed03 == 35098 
replace CA06_margin = 5.11 if ces06_fed03 == 35099 
replace CA06_margin = 25.91 if ces06_fed03 == 35100 
replace CA06_margin = 18.20 if ces06_fed03 == 35101 
replace CA06_margin = 24.10 if ces06_fed03 == 35102 
replace CA06_margin = 22.60 if ces06_fed03 == 35103 
replace CA06_margin = 17.23 if ces06_fed03 == 35104 
replace CA06_margin = 35.79 if ces06_fed03 == 35105 
replace CA06_margin = 49.71 if ces06_fed03 == 35106 
replace CA06_margin = 34.19 if ces06_fed03 == 46001 
replace CA06_margin = 10.61 if ces06_fed03 == 46002 
replace CA06_margin = 12.27 if ces06_fed03 == 46003 
replace CA06_margin = 40.78 if ces06_fed03 == 46004 
replace CA06_margin = 18.72 if ces06_fed03 == 46005 
replace CA06_margin = 9.66 if ces06_fed03 == 46006 
replace CA06_margin = 58.39 if ces06_fed03 == 46007 
replace CA06_margin = 49.84 if ces06_fed03 == 46008 
replace CA06_margin = 3.59 if ces06_fed03 == 46009 
replace CA06_margin = 12.00 if ces06_fed03 == 46010 
replace CA06_margin = 24.09 if ces06_fed03 == 46011 
replace CA06_margin = 36.07 if ces06_fed03 == 46012 
replace CA06_margin = 0.27 if ces06_fed03 == 46013 
replace CA06_margin = 7.76 if ces06_fed03 == 46014 
replace CA06_margin = 38.16 if ces06_fed03 == 47001 
replace CA06_margin = 17.42 if ces06_fed03 == 47002 
replace CA06_margin = 0.28 if ces06_fed03 == 47003 
replace CA06_margin = 49.64 if ces06_fed03 == 47004 
replace CA06_margin = 9.94 if ces06_fed03 == 47005 
replace CA06_margin = 30.60 if ces06_fed03 == 47006 
replace CA06_margin = 14.00 if ces06_fed03 == 47007 
replace CA06_margin = 8.76 if ces06_fed03 == 47008 
replace CA06_margin = 19.62 if ces06_fed03 == 47009 
replace CA06_margin = 6.56 if ces06_fed03 == 47010 
replace CA06_margin = 25.31 if ces06_fed03 == 47011 
replace CA06_margin = 44.31 if ces06_fed03 == 47012 
replace CA06_margin = 21.74 if ces06_fed03 == 47013 
replace CA06_margin = 44.60 if ces06_fed03 == 47014 
replace CA06_margin = 49.88 if ces06_fed03 == 48001 
replace CA06_margin = 53.54 if ces06_fed03 == 48002 
replace CA06_margin = 39.22 if ces06_fed03 == 48003 
replace CA06_margin = 42.80 if ces06_fed03 == 48004 
replace CA06_margin = 51.39 if ces06_fed03 == 48005 
replace CA06_margin = 36.22 if ces06_fed03 == 48006 
replace CA06_margin = 64.83 if ces06_fed03 == 48007 
replace CA06_margin = 60.95 if ces06_fed03 == 48008 
replace CA06_margin = 36.59 if ces06_fed03 == 48009 
replace CA06_margin = 75.16 if ces06_fed03 == 48010 
replace CA06_margin = 37.47 if ces06_fed03 == 48011 
replace CA06_margin = 6.27 if ces06_fed03 == 48012 
replace CA06_margin = 23.97 if ces06_fed03 == 48013 
replace CA06_margin = 41.07 if ces06_fed03 == 48014 
replace CA06_margin = 39.40 if ces06_fed03 == 48015 
replace CA06_margin = 49.61 if ces06_fed03 == 48016 
replace CA06_margin = 50.00 if ces06_fed03 == 48017 
replace CA06_margin = 9.20 if ces06_fed03 == 48018 
replace CA06_margin = 53.60 if ces06_fed03 == 48019 
replace CA06_margin = 66.21 if ces06_fed03 == 48020 
replace CA06_margin = 71.36 if ces06_fed03 == 48021 
replace CA06_margin = 36.71 if ces06_fed03 == 48022 
replace CA06_margin = 65.81 if ces06_fed03 == 48023 
replace CA06_margin = 64.93 if ces06_fed03 == 48024 
replace CA06_margin = 53.22 if ces06_fed03 == 48025 
replace CA06_margin = 65.82 if ces06_fed03 == 48026 
replace CA06_margin = 61.33 if ces06_fed03 == 48027 
replace CA06_margin = 60.24 if ces06_fed03 == 48028 
replace CA06_margin = 46.29 if ces06_fed03 == 59001 
replace CA06_margin = 2.55 if ces06_fed03 == 59002 
replace CA06_margin = 8.85 if ces06_fed03 == 59003 
replace CA06_margin = 20.87 if ces06_fed03 == 59004 
replace CA06_margin = 35.10 if ces06_fed03 == 59005 
replace CA06_margin = 16.56 if ces06_fed03 == 59006 
replace CA06_margin = 5.22 if ces06_fed03 == 59007 
replace CA06_margin = 3.64 if ces06_fed03 == 59008 
replace CA06_margin = 1.90 if ces06_fed03 == 59009 
replace CA06_margin = 8.49 if ces06_fed03 == 59010 
replace CA06_margin = 9.20 if ces06_fed03 == 59011 
replace CA06_margin = 28.48 if ces06_fed03 == 59012 
replace CA06_margin = 29.48 if ces06_fed03 == 59013 
replace CA06_margin = 9.13 if ces06_fed03 == 59014 
replace CA06_margin = 14.64 if ces06_fed03 == 59015 
replace CA06_margin = 2.29 if ces06_fed03 == 59016 
replace CA06_margin = 5.79 if ces06_fed03 == 59017 
replace CA06_margin = 18.16 if ces06_fed03 == 59018 
replace CA06_margin = 5.57 if ces06_fed03 == 59019 
replace CA06_margin = 27.23 if ces06_fed03 == 59020 
replace CA06_margin = 14.06 if ces06_fed03 == 59021 
replace CA06_margin = 42.85 if ces06_fed03 == 59022 
replace CA06_margin = 4.14 if ces06_fed03 == 59023 
replace CA06_margin = 10.61 if ces06_fed03 == 59024 
replace CA06_margin = 15.33 if ces06_fed03 == 59025 
replace CA06_margin = 28.76 if ces06_fed03 == 59026 
replace CA06_margin = 16.01 if ces06_fed03 == 59027 
replace CA06_margin = 18.05 if ces06_fed03 == 59028 
replace CA06_margin = 15.13 if ces06_fed03 == 59029 
replace CA06_margin = 33.15 if ces06_fed03 == 59030 
replace CA06_margin = 1.09 if ces06_fed03 == 59031 
replace CA06_margin = 9.94 if ces06_fed03 == 59032 
replace CA06_margin = 20.25 if ces06_fed03 == 59033 
replace CA06_margin = 20.91 if ces06_fed03 == 59034 
replace CA06_margin = 10.94 if ces06_fed03 == 59035 
replace CA06_margin = 1.54 if ces06_fed03 == 59036 
replace CA06_margin = 24.67 if ces06_fed03 == 60001 
replace CA06_margin = 7.18 if ces06_fed03 == 61001 
replace CA06_margin = 10.92 if ces06_fed03 == 62001 

* Effective number of electoral parties

gen CA06_enep = .

replace CA06_enep = 2.364779 if ces06_fed03 == 10001 
replace CA06_enep = 2.283117 if ces06_fed03 == 10002 
replace CA06_enep = 2.50473 if ces06_fed03 == 10003 
replace CA06_enep = 2.375323 if ces06_fed03 == 10004 
replace CA06_enep = 2.573996 if ces06_fed03 == 10005 
replace CA06_enep = 2.704715 if ces06_fed03 == 10006 
replace CA06_enep = 2.811483 if ces06_fed03 == 10007 
replace CA06_enep = 2.293939 if ces06_fed03 == 11001 
replace CA06_enep = 2.620597 if ces06_fed03 == 11002 
replace CA06_enep = 2.560829 if ces06_fed03 == 11003 
replace CA06_enep = 2.581347 if ces06_fed03 == 11004 
replace CA06_enep = 2.613889 if ces06_fed03 == 12001 
replace CA06_enep = 2.993301 if ces06_fed03 == 12002 
replace CA06_enep = 2.964705 if ces06_fed03 == 12003 
replace CA06_enep = .000042 if ces06_fed03 == 12004 
replace CA06_enep = 2.797838 if ces06_fed03 == 12005 
replace CA06_enep = 2.873898 if ces06_fed03 == 12006 
replace CA06_enep = .000125 if ces06_fed03 == 12007 
replace CA06_enep = 2.620189 if ces06_fed03 == 12008 
replace CA06_enep = 3.339067 if ces06_fed03 == 12009 
replace CA06_enep = 2.741646 if ces06_fed03 == 12010 
replace CA06_enep = 2.980923 if ces06_fed03 == 12011 
replace CA06_enep = 2.688185 if ces06_fed03 == 13001 
replace CA06_enep = 2.78859 if ces06_fed03 == 13002 
replace CA06_enep = 2.937868 if ces06_fed03 == 13003 
replace CA06_enep = 2.827456 if ces06_fed03 == 13004 
replace CA06_enep = 3.074075 if ces06_fed03 == 13005 
replace CA06_enep = 3.065911 if ces06_fed03 == 13006 
replace CA06_enep = 2.816995 if ces06_fed03 == 13007 
replace CA06_enep = 2.517136 if ces06_fed03 == 13008 
replace CA06_enep = 2.750422 if ces06_fed03 == 13009 
replace CA06_enep = .0000396 if ces06_fed03 == 13010 
replace CA06_enep = 2.840239 if ces06_fed03 == 24001 
replace CA06_enep = 3.197724 if ces06_fed03 == 24002 
replace CA06_enep = 3.302754 if ces06_fed03 == 24003 
replace CA06_enep = 2.852981 if ces06_fed03 == 24004 
replace CA06_enep = 2.013628 if ces06_fed03 == 24005 
replace CA06_enep = 3.07148 if ces06_fed03 == 24006 
replace CA06_enep = 3.145735 if ces06_fed03 == 24007 
replace CA06_enep = 2.860043 if ces06_fed03 == 24008 
replace CA06_enep = 3.129949 if ces06_fed03 == 24009 
replace CA06_enep = 3.665502 if ces06_fed03 == 24010 
replace CA06_enep = 3.378792 if ces06_fed03 == 24011 
replace CA06_enep = 2.747456 if ces06_fed03 == 24012 
replace CA06_enep = 3.047348 if ces06_fed03 == 24013 
replace CA06_enep = 2.791237 if ces06_fed03 == 24014 
replace CA06_enep = 2.897268 if ces06_fed03 == 24015 
replace CA06_enep = 3.358928 if ces06_fed03 == 24016 
replace CA06_enep = .000022 if ces06_fed03 == 24017 
replace CA06_enep = 3.02791 if ces06_fed03 == 24018 
replace CA06_enep = 3.077777 if ces06_fed03 == 24019 
replace CA06_enep = 3.438013 if ces06_fed03 == 24020 
replace CA06_enep = 2.747861 if ces06_fed03 == 24021 
replace CA06_enep = 3.304454 if ces06_fed03 == 24022 
replace CA06_enep = 4.013563 if ces06_fed03 == 24023 
replace CA06_enep = 3.306474 if ces06_fed03 == 24024 
replace CA06_enep = 2.638739 if ces06_fed03 == 24025 
replace CA06_enep = 2.333869 if ces06_fed03 == 24026 
replace CA06_enep = 3.076105 if ces06_fed03 == 24027 
replace CA06_enep = 2.411955 if ces06_fed03 == 24028 
replace CA06_enep = 2.960353 if ces06_fed03 == 24029 
replace CA06_enep = 2.787875 if ces06_fed03 == 24030 
replace CA06_enep = 2.829245 if ces06_fed03 == 24031 
replace CA06_enep = 3.285724 if ces06_fed03 == 24032 
replace CA06_enep = 3.342182 if ces06_fed03 == 24033 
replace CA06_enep = 3.165593 if ces06_fed03 == 24034 
replace CA06_enep = 2.74029 if ces06_fed03 == 24035 
replace CA06_enep = 2.550064 if ces06_fed03 == 24036 
replace CA06_enep = 3.731134 if ces06_fed03 == 24037 
replace CA06_enep = 2.497467 if ces06_fed03 == 24038 
replace CA06_enep = 2.989094 if ces06_fed03 == 24039 
replace CA06_enep = 2.985294 if ces06_fed03 == 24040 
replace CA06_enep = 3.099491 if ces06_fed03 == 24041 
replace CA06_enep = 2.715221 if ces06_fed03 == 24042 
replace CA06_enep = 2.285572 if ces06_fed03 == 24043 
replace CA06_enep = 2.123317 if ces06_fed03 == 24044 
replace CA06_enep = 3.550857 if ces06_fed03 == 24045 
replace CA06_enep = 3.162961 if ces06_fed03 == 24046 
replace CA06_enep = 3.905404 if ces06_fed03 == 24047 
replace CA06_enep = 3.045573 if ces06_fed03 == 24048 
replace CA06_enep = 2.951009 if ces06_fed03 == 24049 
replace CA06_enep = .0000533 if ces06_fed03 == 24050 
replace CA06_enep = 3.548464 if ces06_fed03 == 24051 
replace CA06_enep = 3.504619 if ces06_fed03 == 24052 
replace CA06_enep = .0004256 if ces06_fed03 == 24053 
replace CA06_enep = 2.582574 if ces06_fed03 == 24054 
replace CA06_enep = 2.869511 if ces06_fed03 == 24055 
replace CA06_enep = 3.206329 if ces06_fed03 == 24056 
replace CA06_enep = 2.790861 if ces06_fed03 == 24057 
replace CA06_enep = .0002392 if ces06_fed03 == 24058 
replace CA06_enep = 2.454989 if ces06_fed03 == 24059 
replace CA06_enep = 2.828957 if ces06_fed03 == 24060 
replace CA06_enep = 2.741716 if ces06_fed03 == 24061 
replace CA06_enep = 3.04853 if ces06_fed03 == 24062 
replace CA06_enep = 2.567449 if ces06_fed03 == 24063 
replace CA06_enep = 2.757841 if ces06_fed03 == 24064 
replace CA06_enep = 3.276383 if ces06_fed03 == 24065 
replace CA06_enep = 2.471595 if ces06_fed03 == 24066 
replace CA06_enep = 2.577614 if ces06_fed03 == 24067 
replace CA06_enep = 3.068184 if ces06_fed03 == 24068 
replace CA06_enep = 3.271443 if ces06_fed03 == 24069 
replace CA06_enep = 2.917397 if ces06_fed03 == 24070 
replace CA06_enep = 2.464854 if ces06_fed03 == 24071 
replace CA06_enep = 3.034843 if ces06_fed03 == 24072 
replace CA06_enep = 3.25452 if ces06_fed03 == 24073 
replace CA06_enep = 2.543914 if ces06_fed03 == 24074 
replace CA06_enep = 3.494085 if ces06_fed03 == 24075 
replace CA06_enep = 2.708066 if ces06_fed03 == 35001 
replace CA06_enep = 3.12354 if ces06_fed03 == 35002 
replace CA06_enep = 3.130867 if ces06_fed03 == 35003 
replace CA06_enep = 2.871041 if ces06_fed03 == 35004 
replace CA06_enep = 3.109576 if ces06_fed03 == 35005 
replace CA06_enep = 2.622915 if ces06_fed03 == 35006 
replace CA06_enep = 2.843037 if ces06_fed03 == 35007 
replace CA06_enep = 2.613217 if ces06_fed03 == 35008 
replace CA06_enep = 3.191044 if ces06_fed03 == 35009 
replace CA06_enep = 2.800075 if ces06_fed03 == 35010 
replace CA06_enep = 2.969871 if ces06_fed03 == 35011 
replace CA06_enep = 2.555758 if ces06_fed03 == 35012 
replace CA06_enep = 3.009693 if ces06_fed03 == 35013 
replace CA06_enep = 2.913718 if ces06_fed03 == 35014 
replace CA06_enep = 2.57427 if ces06_fed03 == 35015 
replace CA06_enep = 2.53289 if ces06_fed03 == 35016 
replace CA06_enep = 2.468348 if ces06_fed03 == 35017 
replace CA06_enep = 2.904627 if ces06_fed03 == 35018 
replace CA06_enep = 2.583504 if ces06_fed03 == 35019 
replace CA06_enep = 3.143075 if ces06_fed03 == 35020 
replace CA06_enep = 3.015818 if ces06_fed03 == 35021 
replace CA06_enep = 2.523728 if ces06_fed03 == 35022 
replace CA06_enep = 2.933855 if ces06_fed03 == 35023 
replace CA06_enep = 2.262893 if ces06_fed03 == 35024 
replace CA06_enep = 2.772774 if ces06_fed03 == 35025 
replace CA06_enep = 2.961972 if ces06_fed03 == 35026 
replace CA06_enep = 3.424327 if ces06_fed03 == 35027 
replace CA06_enep = .0002126 if ces06_fed03 == 35028 
replace CA06_enep = 2.817464 if ces06_fed03 == 35029 
replace CA06_enep = 2.646961 if ces06_fed03 == 35030 
replace CA06_enep = 2.768168 if ces06_fed03 == 35031 
replace CA06_enep = 3.141785 if ces06_fed03 == 35032 
replace CA06_enep = 3.165591 if ces06_fed03 == 35033 
replace CA06_enep = 3.017402 if ces06_fed03 == 35034 
replace CA06_enep = 3.1274 if ces06_fed03 == 35035 
replace CA06_enep = 3.109412 if ces06_fed03 == 35036 
replace CA06_enep = 3.052541 if ces06_fed03 == 35037 
replace CA06_enep = 2.91479 if ces06_fed03 == 35038 
replace CA06_enep = .0005412 if ces06_fed03 == 35039 
replace CA06_enep = 2.847985 if ces06_fed03 == 35040 
replace CA06_enep = 2.60129 if ces06_fed03 == 35041 
replace CA06_enep = 3.21427 if ces06_fed03 == 35042 
replace CA06_enep = 3.227763 if ces06_fed03 == 35043 
replace CA06_enep = 3.160489 if ces06_fed03 == 35044 
replace CA06_enep = 2.166914 if ces06_fed03 == 35045 
replace CA06_enep = .0000353 if ces06_fed03 == 35046 
replace CA06_enep = 2.507336 if ces06_fed03 == 35047 
replace CA06_enep = 2.633073 if ces06_fed03 == 35048 
replace CA06_enep = 2.708917 if ces06_fed03 == 35049 
replace CA06_enep = 1.090381 if ces06_fed03 == 35050 
replace CA06_enep = .0178085 if ces06_fed03 == 35051 
replace CA06_enep = 2.520388 if ces06_fed03 == 35052 
replace CA06_enep = 2.703041 if ces06_fed03 == 35053 
replace CA06_enep = 3.050205 if ces06_fed03 == 35054 
replace CA06_enep = 2.888261 if ces06_fed03 == 35055 
replace CA06_enep = 2.823561 if ces06_fed03 == 35056 
replace CA06_enep = 2.859094 if ces06_fed03 == 35057 
replace CA06_enep = 2.99111 if ces06_fed03 == 35058 
replace CA06_enep = 2.622423 if ces06_fed03 == 35059 
replace CA06_enep = 2.652776 if ces06_fed03 == 35060 
replace CA06_enep = 3.124751 if ces06_fed03 == 35061 
replace CA06_enep = 3.526435 if ces06_fed03 == 35062 
replace CA06_enep = 2.893173 if ces06_fed03 == 35063 
replace CA06_enep = 2.817957 if ces06_fed03 == 35064 
replace CA06_enep = 3.193312 if ces06_fed03 == 35065 
replace CA06_enep = 3.026563 if ces06_fed03 == 35066 
replace CA06_enep = .0000513 if ces06_fed03 == 35067 
replace CA06_enep = 3.080111 if ces06_fed03 == 35068 
replace CA06_enep = 2.927439 if ces06_fed03 == 35069 
replace CA06_enep = 3.133115 if ces06_fed03 == 35070 
replace CA06_enep = 3.30886 if ces06_fed03 == 35071 
replace CA06_enep = 2.545457 if ces06_fed03 == 35072 
replace CA06_enep = .0001393 if ces06_fed03 == 35073 
replace CA06_enep = 2.447865 if ces06_fed03 == 35074 
replace CA06_enep = 2.495428 if ces06_fed03 == 35075 
replace CA06_enep = 3.11218 if ces06_fed03 == 35076 
replace CA06_enep = 2.79201 if ces06_fed03 == 35077 
replace CA06_enep = 3.13341 if ces06_fed03 == 35078 
replace CA06_enep = 3.063614 if ces06_fed03 == 35079 
replace CA06_enep = 2.167132 if ces06_fed03 == 35080 
replace CA06_enep = 2.487064 if ces06_fed03 == 35081 
replace CA06_enep = 2.582575 if ces06_fed03 == 35082 
replace CA06_enep = 2.064525 if ces06_fed03 == 35083 
replace CA06_enep = 2.925147 if ces06_fed03 == 35084 
replace CA06_enep = 2.784176 if ces06_fed03 == 35085 
replace CA06_enep = 2.990749 if ces06_fed03 == 35086 
replace CA06_enep = 2.546041 if ces06_fed03 == 35087 
replace CA06_enep = 3.096845 if ces06_fed03 == 35088 
replace CA06_enep = 2.479852 if ces06_fed03 == 35089 
replace CA06_enep = 3.221239 if ces06_fed03 == 35090 
replace CA06_enep = 3.289994 if ces06_fed03 == 35091 
replace CA06_enep = 2.550909 if ces06_fed03 == 35092 
replace CA06_enep = 2.739423 if ces06_fed03 == 35093 
replace CA06_enep = 2.728612 if ces06_fed03 == 35094 
replace CA06_enep = 2.613444 if ces06_fed03 == 35095 
replace CA06_enep = 2.305176 if ces06_fed03 == 35096 
replace CA06_enep = 3.257789 if ces06_fed03 == 35097 
replace CA06_enep = 2.77089 if ces06_fed03 == 35098 
replace CA06_enep = 2.771008 if ces06_fed03 == 35099 
replace CA06_enep = 2.465609 if ces06_fed03 == 35100 
replace CA06_enep = 2.992107 if ces06_fed03 == 35101 
replace CA06_enep = 2.849455 if ces06_fed03 == 35102 
replace CA06_enep = 2.58026 if ces06_fed03 == 35103 
replace CA06_enep = 2.884677 if ces06_fed03 == 35104 
replace CA06_enep = 2.483381 if ces06_fed03 == 35105 
replace CA06_enep = .0002565 if ces06_fed03 == 35106 
replace CA06_enep = 2.687629 if ces06_fed03 == 46001 
replace CA06_enep = 2.696334 if ces06_fed03 == 46002 
replace CA06_enep = 3.456598 if ces06_fed03 == 46003 
replace CA06_enep = 2.398733 if ces06_fed03 == 46004 
replace CA06_enep = 2.642734 if ces06_fed03 == 46005 
replace CA06_enep = 2.945611 if ces06_fed03 == 46006 
replace CA06_enep = 1.940137 if ces06_fed03 == 46007 
replace CA06_enep = 2.094028 if ces06_fed03 == 46008 
replace CA06_enep = 3.117019 if ces06_fed03 == 46009 
replace CA06_enep = 2.578715 if ces06_fed03 == 46010 
replace CA06_enep = 2.969506 if ces06_fed03 == 46011 
replace CA06_enep = 2.477906 if ces06_fed03 == 46012 
replace CA06_enep = 2.772139 if ces06_fed03 == 46013 
replace CA06_enep = 3.29696 if ces06_fed03 == 46014 
replace CA06_enep = 2.82765 if ces06_fed03 == 47001 
replace CA06_enep = 2.82878 if ces06_fed03 == 47002 
replace CA06_enep = 2.746641 if ces06_fed03 == 47003 
replace CA06_enep = 2.047631 if ces06_fed03 == 47004 
replace CA06_enep = 2.975984 if ces06_fed03 == 47005 
replace CA06_enep = 2.555475 if ces06_fed03 == 47006 
replace CA06_enep = 3.041651 if ces06_fed03 == 47007 
replace CA06_enep = 3.036443 if ces06_fed03 == 47008 
replace CA06_enep = 2.79822 if ces06_fed03 == 47009 
replace CA06_enep = 2.669241 if ces06_fed03 == 47010 
replace CA06_enep = 2.840266 if ces06_fed03 == 47011 
replace CA06_enep = 2.219198 if ces06_fed03 == 47012 
replace CA06_enep = 2.622988 if ces06_fed03 == 47013 
replace CA06_enep = 2.179645 if ces06_fed03 == 47014 
replace CA06_enep = 2.156387 if ces06_fed03 == 48001 
replace CA06_enep = 2.057647 if ces06_fed03 == 48002 
replace CA06_enep = 2.669828 if ces06_fed03 == 48003 
replace CA06_enep = .0029721 if ces06_fed03 == 48004 
replace CA06_enep = 1.965334 if ces06_fed03 == 48005 
replace CA06_enep = 2.665988 if ces06_fed03 == 48006 
replace CA06_enep = 1.705261 if ces06_fed03 == 48007 
replace CA06_enep = 1.82138 if ces06_fed03 == 48008 
replace CA06_enep = 2.432759 if ces06_fed03 == 48009 
replace CA06_enep = 1.444691 if ces06_fed03 == 48010 
replace CA06_enep = 2.429305 if ces06_fed03 == 48011 
replace CA06_enep = 2.74482 if ces06_fed03 == 48012 
replace CA06_enep = 2.804293 if ces06_fed03 == 48013 
replace CA06_enep = 2.341154 if ces06_fed03 == 48014 
replace CA06_enep = 2.376911 if ces06_fed03 == 48015 
replace CA06_enep = 2.194345 if ces06_fed03 == 48016 
replace CA06_enep = 2.043457 if ces06_fed03 == 48017 
replace CA06_enep = 3.173934 if ces06_fed03 == 48018 
replace CA06_enep = 2.055117 if ces06_fed03 == 48019 
replace CA06_enep = 1.705391 if ces06_fed03 == 48020 
replace CA06_enep = 1.537691 if ces06_fed03 == 48021 
replace CA06_enep = 2.581966 if ces06_fed03 == 48022 
replace CA06_enep = 1.68143 if ces06_fed03 == 48023 
replace CA06_enep = 1.754115 if ces06_fed03 == 48024 
replace CA06_enep = 1.997853 if ces06_fed03 == 48025 
replace CA06_enep = 1.706764 if ces06_fed03 == 48026 
replace CA06_enep = 1.827003 if ces06_fed03 == 48027 
replace CA06_enep = 1.878118 if ces06_fed03 == 48028 
replace CA06_enep = 2.228847 if ces06_fed03 == 59001 
replace CA06_enep = 3.192586 if ces06_fed03 == 59002 
replace CA06_enep = 3.149269 if ces06_fed03 == 59003 
replace CA06_enep = 3.154917 if ces06_fed03 == 59004 
replace CA06_enep = 2.579154 if ces06_fed03 == 59005 
replace CA06_enep = 2.774431 if ces06_fed03 == 59006 
replace CA06_enep = 3.067981 if ces06_fed03 == 59007 
replace CA06_enep = 3.348408 if ces06_fed03 == 59008 
replace CA06_enep = 3.55826 if ces06_fed03 == 59009 
replace CA06_enep = 3.176753 if ces06_fed03 == 59010 
replace CA06_enep = .0000126 if ces06_fed03 == 59011 
replace CA06_enep = 2.604131 if ces06_fed03 == 59012 
replace CA06_enep = 2.728034 if ces06_fed03 == 59013 
replace CA06_enep = 3.181489 if ces06_fed03 == 59014 
replace CA06_enep = 2.873034 if ces06_fed03 == 59015 
replace CA06_enep = 3.188217 if ces06_fed03 == 59016 
replace CA06_enep = 3.231604 if ces06_fed03 == 59017 
replace CA06_enep = 3.07257 if ces06_fed03 == 59018 
replace CA06_enep = 2.9615 if ces06_fed03 == 59019 
replace CA06_enep = 2.874132 if ces06_fed03 == 59020 
replace CA06_enep = 3.344883 if ces06_fed03 == 59021 
replace CA06_enep = 2.399943 if ces06_fed03 == 59022 
replace CA06_enep = 2.819272 if ces06_fed03 == 59023 
replace CA06_enep = 3.491542 if ces06_fed03 == 59024 
replace CA06_enep = 2.775291 if ces06_fed03 == 59025 
replace CA06_enep = 3.026379 if ces06_fed03 == 59026 
replace CA06_enep = 2.914061 if ces06_fed03 == 59027 
replace CA06_enep = 3.079108 if ces06_fed03 == 59028 
replace CA06_enep = 3.131087 if ces06_fed03 == 59029 
replace CA06_enep = 2.523791 if ces06_fed03 == 59030 
replace CA06_enep = 2.792713 if ces06_fed03 == 59031 
replace CA06_enep = 2.964832 if ces06_fed03 == 59032 
replace CA06_enep = 2.829472 if ces06_fed03 == 59033 
replace CA06_enep = 2.8569 if ces06_fed03 == 59034 
replace CA06_enep = 3.438379 if ces06_fed03 == 59035 
replace CA06_enep = 3.182574 if ces06_fed03 == 59036 
replace CA06_enep = 2.857989 if ces06_fed03 == 60001 
replace CA06_enep = 2.941221 if ces06_fed03 == 61001 
replace CA06_enep = 3.528398 if ces06_fed03 == 62001 


**************************************************
** INDEPENDENT VARIABLES: 2006 FEDERAL ELECTION **
**************************************************

* Party identification (national) // Alliance and Progressive Conservative recoded as Conservative

gen CA06_pid = max(ces06_cps_q1a,ces06_cps_q1b) // Merge answers from randomized question wording experiment

gen CA06_pidstatus_whole = .

replace CA04_pidstatus_whole = 9999 if CA06_pid == 99 & ces06_cps_q4 == .
replace CA06_pidstatus_whole = 9999 if CA06_pid == . & ces06_cps_q4 == .
replace CA06_pidstatus_whole = 9999 if ces06_cps_q3 == 1 & ces06_cps_q4 == 98 | ces06_cps_q3 == 1 & ces06_cps_q4 == 99
replace CA06_pidstatus_whole = 9999 if CA06_pid == 98 & ces06_cps_q3 == 8 | CA06_pid == 98 & ces06_cps_q3 == 9 | CA06_pid == 99 & ces06_cps_q3 == 8 | CA06_pid == 99 & ces06_cps_q3 == 9 | CA06_pid == 0 & ces06_cps_q3 == 9

replace CA06_pidstatus_whole = 2 if CA06_pid == 97 & ces06_cps_q3 == 5 | CA06_pid == 97 & ces06_cps_q3 == 8 | CA06_pid == 97 & ces06_cps_q3 == 9 | CA06_pid == 98 & ces06_cps_q3 == 5

replace CA06_pidstatus_whole = 3 if CA06_pid == 2 & CA06_pidstatus_whole!=2 & CA06_pidstatus_whole!=9999
replace CA06_pidstatus_whole = 3 if ces06_cps_q4 == 2 & CA06_pidstatus_whole!=2 & CA06_pidstatus_whole!=9999

replace CA06_pidstatus_whole = 1 if CA06_pid!=2 & CA06_pid!=. & CA06_pidstatus_whole!=2 & CA06_pidstatus_whole!=3 & CA06_pidstatus_whole!=9999
replace CA06_pidstatus_whole = 1 if ces06_cps_q4!=2 & ces06_cps_q4!=. & CA06_pidstatus_whole!=2 & CA06_pidstatus_whole!=3 & CA06_pidstatus_whole!=9999

gen CA06_winner_leaner_whole = 1 if ces06_cps_q3 == 1 & CA06_pidstatus_whole == 3
gen CA06_loser_leaner_whole = 1 if ces06_cps_q3 == 1 & CA06_pidstatus_whole == 1

replace CA06_pidstatus_whole = . if CA06_pidstatus_whole == 9999

label values CA06_pidstatus_whole pidstatus

* Party identification scale (national)

gen CA06_pidscale_whole = .

replace CA06_pidscale_whole = 1 if CA06_pidstatus_whole == 1 & ces06_cps_q2 == 1
replace CA06_pidscale_whole = 2 if CA06_pidstatus_whole == 1 & ces06_cps_q2 == 3
replace CA06_pidscale_whole = 3 if CA06_pidstatus_whole == 1 & ces06_cps_q2 == 5 | CA06_loser_leaner_whole == 1
replace CA06_pidscale_whole = 4 if CA06_pidstatus_whole == 2
replace CA06_pidscale_whole = 5 if CA06_pidstatus_whole == 3 & ces06_cps_q2 == 5 | CA06_winner_leaner_whole == 1
replace CA06_pidscale_whole = 6 if CA06_pidstatus_whole == 3 & ces06_cps_q2 == 3
replace CA06_pidscale_whole = 7 if CA06_pidstatus_whole == 3 & ces06_cps_q2 == 1

label values CA06_pidscale_whole pidscale

* Party identification (district)

gen CA06_pidstatus_district = .

replace CA06_pidstatus_whole = 9999 if CA06_pid == 99 & ces06_cps_q4 == .
replace CA06_pidstatus_district = 9999 if CA06_pid == . & ces06_cps_q4 == . // Replace by 9999 is missing data for party identification
replace CA06_pidstatus_district = 9999 if ces06_cps_q3 == 1 & ces06_cps_q4 == 98 | ces06_cps_q3 == 1 & ces06_cps_q4 == 99 // Replace by 9999 if respondent feels a little closer to one party but don't know which or refused to say which
replace CA06_pidstatus_district = 9999 if CA06_pid == 98 & ces06_cps_q3 == 8 | CA06_pid == 98 & ces06_cps_q3 == 9 | CA06_pid == 99 & ces06_cps_q3 == 8 | CA06_pid == 99 & ces06_cps_q3 == 9 // Replace by 9999 if respondent don't know if he/she identifies with a party or refused to say and don't know if he/she feels a little closer to one party or refused to say 

replace CA06_pidstatus_district = 2 if CA06_pid == 97 & ces06_cps_q3 == 5 | CA06_pid == 97 & ces06_cps_q3 == 8 | CA06_pid == 97 & ces06_cps_q3 == 9 | CA06_pid == 98 & ces06_cps_q3 == 5 // No PID

replace CA06_pidstatus_district = 3 if CA06_pid == CA06_district_outcome & CA06_pidstatus_district!=2 & CA06_pidstatus_district!=9999 // Winner PID
replace CA06_pidstatus_district = 3 if ces06_cps_q4 == CA06_district_outcome & CA06_pidstatus_district!=2 & CA06_pidstatus_district!=9999 // Winner PID

replace CA06_pidstatus_district = 1 if CA06_pid!=CA06_district_outcome & CA06_pid!=. & CA06_pidstatus_district!=2 & CA06_pidstatus_district!=3 & CA06_pidstatus_district!=9999 // Loser PID
replace CA06_pidstatus_district = 1 if ces06_cps_q4!=CA06_district_outcome & ces06_cps_q4!=. & CA06_pidstatus_district!=2 & CA06_pidstatus_district!=3 & CA06_pidstatus_district!=9999 // Loser PID

gen CA06_winner_leaner_district = 1 if ces06_cps_q3 == 1 & CA06_pidstatus_district == 3 // Winner leaner
gen CA06_loser_leaner_district = 1 if ces06_cps_q3 == 1 & CA06_pidstatus_district == 1 // Loser leaner

replace CA06_pidstatus_district = . if CA06_pidstatus_district == 9999 // Missing data
 
label values CA06_pidstatus_district pidstatus

* Party identification scale (district)

gen CA06_pidscale_district = .

replace CA06_pidscale_district = 1 if CA06_pidstatus_district == 1 & ces06_cps_q2 == 1 // Strong (very strongly) loser PID
replace CA06_pidscale_district = 2 if CA06_pidstatus_district == 1 & ces06_cps_q2 == 3 // Moderate (fairly strongly) loser PID
replace CA06_pidscale_district = 3 if CA06_pidstatus_district == 1 & ces06_cps_q2 == 5 | CA06_loser_leaner_district == 1 // Moderate (not very strongly) loser PID
replace CA06_pidscale_district = 4 if CA06_pidstatus_district == 2 // No PID
replace CA06_pidscale_district = 5 if CA06_pidstatus_district == 3 & ces06_cps_q2 == 5 | CA06_winner_leaner_district == 1 // Weak (not very strongly) winner PID
replace CA06_pidscale_district = 6 if CA06_pidstatus_district == 3 & ces06_cps_q2 == 3 // Moderate (fairly strongly) winner PID
replace CA06_pidscale_district = 7 if CA06_pidstatus_district == 3 & ces06_cps_q2 == 1 // Strong (very strongly) winner PID

label values CA06_pidscale_district pidscale

* Interest for election

gen CA06_interest = ces06_cps_a7 // Interest for election

recode CA06_interest (98=.) // Recode "don't know" as missing data
recode CA06_interest (99=.) // Recode "refused" as missing data

* Election news attentiveness

gen CA06_tv = ces06_cps_a3 // Attention paid to election on TV

recode CA06_tv (98=.) // Recode "don't know" as missing data
recode CA06_tv (99=.) // Recode "refused" as missing data

gen CA06_radio = ces06_cps_a4 // Attention paid to election on radio

recode CA06_radio (98=.) // Recode "don't know" as missing data
recode CA06_radio (99=.) // Recode "refused" as missing data

gen CA06_newspapers = ces06_cps_a5 // Attention paid to election in newspapers

recode CA06_newspapers (98=.) // Recode "don't know" as missing data
recode CA06_newspapers (99=.) // Recode "refused" as missing data

gen CA06_internet = ces06_cps_a6 // Attention paid to election on internet

recode CA06_internet (98=.) // Recode "don't know" as missing data
recode CA06_internet (99=.) // Recode "refused" as missing data

egen CA06_news = rowmax(CA06_tv CA06_radio CA06_newspapers CA06_internet) // Election news attentiveness

* Education

gen CA06_education = ces06_cps_s3 // Highest level of education completed by respondent

replace CA06_education = CA04_education if CA06_education == . & survey_type040608 > 12

recode CA06_education (98=.) // Recode "don't know" as missing data
recode CA06_education (99=.) // Recode "refused" as missing data

* Response date

gen CA06_surveydate = mdy(ces06_cps_intmonth,ces06_cps_intday,ces06_cps_intyear) // Interview date

format %tdMon_DD,_CCYY CA06_surveydate // Format interview date: DDMMYYYY

gen CA06_edate = 20060123 // Election date

gen CA06_electiondate = date(string(CA06_edate,"%8.0f"),"YMD") 

format %tdMon_DD,_CCYY CA06_electiondate // Format election date: DDMMYYYY

gen CA06_time = (CA06_electiondate - CA06_surveydate) - 1 // Number of days between interview and election - Substract 1 to correct for election date

* Gender

gen CA06_male = gender // Gender

recode CA06_male (5=0) // Recode female = 0

* Age

gen CA06_yearofbirth = yearofbirth // Year of birth

recode CA06_yearofbirth (9998=.) // Recode "don't know" as missing data
recode CA06_yearofbirth (9999=.) // Recode "refused" as missing data

gen CA06_age = 2006 - CA06_yearofbirth // Age

replace CA06_age = . if CA06_age < 17 // Recode respondents less than 17 years old as missing data

* Name of NDP leader - Correct answer (Jack Layton) = 1, Incorrect answer = 0

gen CA06_ndpleader = ces06_cps_e1 // NDP leader

recode CA06_ndpleader (5=0) // Recode "any other answer" as incorrect answer
recode CA06_ndpleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA06_ndpleader (8=0) // Recode "don't know" as incorrect answer
recode CA06_ndpleader (9=.) // Recode "refused" as missing data

* Name of Conservative leader - Correct answer (Stephen Harper) = 1, Incorrect answer = 0

gen CA06_cpcleader = ces06_cps_e2 // Conservative leader

recode CA06_cpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA06_cpcleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA06_cpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA06_cpcleader (9=.) // Recode "refused" as missing data

* Name of Liberal leader - Correct answer (Paul Martin) = 1, Incorrect answer = 0

gen CA06_lpcleader = ces06_cps_e4 // Liberal leader

recode CA06_lpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA06_lpcleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA06_lpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA06_lpcleader (9=.) // Recode "refused" as missing data

* Name of the British Prime Minister - Correct answer (Tony Blair) = 1, Incorrect answer = 0

gen CA06_britishpm = ces06_cps_know_3 // British Prime Minister

recode CA06_britishpm (5=0) // Recode "any other name" as incorrect answer
recode CA06_britishpm (8=0) // Recode "don't know" as incorrect answer
recode CA06_britishpm (9=.) // Recode "refused" as missing data

* Name of a female Cabinet Minister in the federal government - Correct answer (Anne McLellan, Aileen Carroll, Liza Frulla, Ethel Blondin, Lucienne Robillard, Belinda Stronach, Carolyn Bennett, Claudette Bradshaw, Albina Guarineri) = 1, Incorrect answer = 0

gen CA06_femaleminister = ces06_cps_know_5 // Female Cabinet Minister

recode CA06_femaleminister (5=0) // Recode "any other answer" as incorrect answer
recode CA06_femaleminister (7=0) // Recode "R volunteers: Sheila Copps" as incorrect answer
recode CA06_femaleminister (8=0) // Recode "don't know" as incorrect answer
recode CA06_femaleminister (9=.) // Recode "refused" as missing data

* Name of the judge who is heading the commission of inquiry into the sponsorship scandal - Correct answer (John Gomery) = 1, Incorrect answer = 0

gen CA06_judgeA = ces06_cps_know_6a // Gomery Commission (open answer)
gen CA06_judgeB = ces06_cps_know_6b // Gomery Commission (answer choices)

recode CA06_judgeA (5=0) // Recode "any other name" as incorrect answer
recode CA06_judgeA (8=0) // Recode "don't know" as incorrect answer
recode CA06_judgeA (9=.) // Recode "refused" as missing data

recode CA06_judgeB (3=1) // Recode "John Gomery" as correct answer
recode CA06_judgeB (1=0) // Recode "Alan Gold" as incorrect answer
recode CA06_judgeB (2=0) // Recode "Irwin Cotler" as incorrect answer
recode CA06_judgeB (4=0) // Recode "Beverley McLachlin" as incorrect answer
recode CA06_judgeB (8=0) // Recode "don't know" as incorrect answer
recode CA06_judgeB (9=.) // Recode "refused" as missing data

gen CA06_judge = max(CA06_judgeA,CA06_judgeB) // Combine answers for Gomery Commission

* Name of the provincial premier - Correct answer (Danny Williams in Newfoundland, Pat Binns in Prince Edward Island, John Hamm in Nova Scotia, Bernard Lord in New Brunswick, Jean Charest in Quebec, Dalton McGuinty in Ontario, Gary Doer in Manitoba, Lorne Calvert in Saskatchewan, Ralph Klein in Alberta, Gordon Campbell in British Columbia) = 1, Incorrect answer = 0

gen CA06_premier = ces06_cps_know_1 // Provincial premier

recode CA06_premier (10=1) if ces06_province == 10 // Premier of Newfoundland: correct answer
recode CA06_premier (11=1) if ces06_province == 11 // Premier of Prince Edward Island: correct answer
recode CA06_premier (12=1) if ces06_province == 12 // Premier of Nova Scotia: correct answer
recode CA06_premier (13=1) if ces06_province == 13 // Premier of New Brunswick: correct answer
recode CA06_premier (24=1) if ces06_province == 24 // Premier of Quebec: correct answer
recode CA06_premier (35=1) if ces06_province == 35 // Premier of Ontario: correct answer
recode CA06_premier (46=1) if ces06_province == 46 // Premier of Manitoba: correct answer
recode CA06_premier (47=1) if ces06_province == 47 // Premier of Saskatchewan: correct answer
recode CA06_premier (48=1) if ces06_province == 48 // Premier of Alberta: correct answer
recode CA06_premier (59=1) if ces06_province == 59 // Premier of British Columbia: correct answer
recode CA06_premier (97=0) // Recode "any other name" as incorrect answer
recode CA06_premier (98=0) // Recode "don't know'" as incorrect answer
recode CA06_premier (99=.) // Recode "refused" as incorrect answer

recode CA06_premier (10=0) if ces06_province!=10 & CA06_premier!=. // Premier of Newfoundland: incorrect answer
recode CA06_premier (11=0) if ces06_province!=11 & CA06_premier!=. // Premier of Prince Edward Island: incorrect answer
recode CA06_premier (12=0) if ces06_province!=12 & CA06_premier!=. // Premier of Nova Scotia: incorrect answer
recode CA06_premier (13=0) if ces06_province!=13 & CA06_premier!=. // Premier of New Brunswick: incorrect answer
recode CA06_premier (24=0) if ces06_province!=24 & CA06_premier!=. // Premier of Quebec: incorrect answer
recode CA06_premier (35=0) if ces06_province!=35 & CA06_premier!=. // Premier of Ontario: incorrect answer
recode CA06_premier (46=0) if ces06_province!=46 & CA06_premier!=. // Premier of Manitoba: incorrect answer
recode CA06_premier (47=0) if ces06_province!=47 & CA06_premier!=. // Premier of Saskatchewan: incorrect answer
recode CA06_premier (48=0) if ces06_province!=48 & CA06_premier!=. // Premier of Alberta: correct answer
recode CA06_premier (59=0) if ces06_province!=59 & CA06_premier!=. // Premier of British Columbia: correct answer

* Party promising to cut the GST from 7 to 5 percent - Correct answer (Conservative) = 1, Incorrect answer = 0

gen CA06_gstcut = _v86 

recode CA06_gstcut (7=0) 
recode CA06_gstcut (8=0) 
recode CA06_gstcut (9=.) 

* Political knowledge index

gen CA06_knowledge = CA06_ndpleader + CA06_cpcleader + CA06_lpcleader + CA06_britishpm + CA06_femaleminister + CA06_judge + CA06_premier + CA06_gstcut // Political knowledge index

* Political discussion (pre)

gen CA06_discussion = ces06_cps_a9

recode CA06_discussion (8=.)
recode CA06_discussion (9=.)

replace CA06_discussion = 30 if CA06_discussion == 1
replace CA06_discussion = 20 if CA06_discussion == 3
replace CA06_discussion = 10 if CA06_discussion == 5

replace CA06_discussion = 2 if CA06_discussion == 30
replace CA06_discussion = 1 if CA06_discussion == 20
replace CA06_discussion = 0 if CA06_discussion == 10

* Political discussion (post)

gen CA06_discussion_post = ces06_pes_a5

recode CA06_discussion_post (8=.)
recode CA06_discussion_post (9=.)

replace CA06_discussion_post = 30 if CA06_discussion_post == 1
replace CA06_discussion_post = 20 if CA06_discussion_post == 3
replace CA06_discussion_post = 10 if CA06_discussion_post == 5

replace CA06_discussion_post = 2 if CA06_discussion_post == 30
replace CA06_discussion_post = 1 if CA06_discussion_post == 20
replace CA06_discussion_post = 0 if CA06_discussion_post == 10

* Main source of information

gen CA06_network_main = 1 if ces06_pes_a3 == 5 | ces06_pes_a3 == 6

replace CA06_network_main = 0 if ces06_pes_a3!=5 & ces06_pes_a3!=6
replace CA06_network_main = . if ces06_pes_a3 == 8
replace CA06_network_main = . if ces06_pes_a3 == 9


****************************************************
** DISTRICT-LEVEL OUTCOMES: 2008 FEDERAL ELECTION **
****************************************************

* Note: 1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 5 = GPC, 88 = independent

destring fed_name_08, generate(ces08_fed03)

gen CA08_district_outcome = .

replace CA08_district_outcome = 1 if ces08_fed03 == 10001 
replace CA08_district_outcome = 1 if ces08_fed03 == 10002 
replace CA08_district_outcome = 1 if ces08_fed03 == 10003 
replace CA08_district_outcome = 1 if ces08_fed03 == 10004 
replace CA08_district_outcome = 1 if ces08_fed03 == 10005 
replace CA08_district_outcome = 3 if ces08_fed03 == 10006 
replace CA08_district_outcome = 1 if ces08_fed03 == 10007 
replace CA08_district_outcome = 1 if ces08_fed03 == 11001 
replace CA08_district_outcome = 1 if ces08_fed03 == 11002 
replace CA08_district_outcome = 2 if ces08_fed03 == 11003 
replace CA08_district_outcome = 1 if ces08_fed03 == 11004 
replace CA08_district_outcome = 1 if ces08_fed03 == 12001 
replace CA08_district_outcome = 2 if ces08_fed03 == 12002 
replace CA08_district_outcome = 1 if ces08_fed03 == 12003 
replace CA08_district_outcome = 3 if ces08_fed03 == 12004 
replace CA08_district_outcome = 1 if ces08_fed03 == 12005 
replace CA08_district_outcome = 1 if ces08_fed03 == 12006 
replace CA08_district_outcome = 88 if ces08_fed03 == 12007 
replace CA08_district_outcome = 3 if ces08_fed03 == 12008 
replace CA08_district_outcome = 2 if ces08_fed03 == 12009 
replace CA08_district_outcome = 1 if ces08_fed03 == 12010 
replace CA08_district_outcome = 2 if ces08_fed03 == 12011 
replace CA08_district_outcome = 3 if ces08_fed03 == 13001 
replace CA08_district_outcome = 1 if ces08_fed03 == 13002 
replace CA08_district_outcome = 2 if ces08_fed03 == 13003 
replace CA08_district_outcome = 2 if ces08_fed03 == 13004 
replace CA08_district_outcome = 1 if ces08_fed03 == 13005 
replace CA08_district_outcome = 2 if ces08_fed03 == 13006 
replace CA08_district_outcome = 1 if ces08_fed03 == 13007 
replace CA08_district_outcome = 2 if ces08_fed03 == 13008 
replace CA08_district_outcome = 2 if ces08_fed03 == 13009 
replace CA08_district_outcome = 2 if ces08_fed03 == 13010 
replace CA08_district_outcome = 4 if ces08_fed03 == 24001 
replace CA08_district_outcome = 4 if ces08_fed03 == 24002 
replace CA08_district_outcome = 4 if ces08_fed03 == 24003 
replace CA08_district_outcome = 4 if ces08_fed03 == 24004 
replace CA08_district_outcome = 2 if ces08_fed03 == 24005 
replace CA08_district_outcome = 4 if ces08_fed03 == 24006 
replace CA08_district_outcome = 2 if ces08_fed03 == 24007 
replace CA08_district_outcome = 4 if ces08_fed03 == 24008 
replace CA08_district_outcome = 1 if ces08_fed03 == 24009 
replace CA08_district_outcome = 4 if ces08_fed03 == 24010 
replace CA08_district_outcome = 1 if ces08_fed03 == 24011 
replace CA08_district_outcome = 4 if ces08_fed03 == 24012 
replace CA08_district_outcome = 2 if ces08_fed03 == 24013 
replace CA08_district_outcome = 4 if ces08_fed03 == 24014 
replace CA08_district_outcome = 4 if ces08_fed03 == 24015 
replace CA08_district_outcome = 4 if ces08_fed03 == 24016 
replace CA08_district_outcome = 4 if ces08_fed03 == 24017 
replace CA08_district_outcome = 4 if ces08_fed03 == 24018 
replace CA08_district_outcome = 4 if ces08_fed03 == 24019 
replace CA08_district_outcome = 4 if ces08_fed03 == 24020 
replace CA08_district_outcome = 4 if ces08_fed03 == 24021 
replace CA08_district_outcome = 1 if ces08_fed03 == 24022 
replace CA08_district_outcome = 1 if ces08_fed03 == 24023 
replace CA08_district_outcome = 4 if ces08_fed03 == 24024 
replace CA08_district_outcome = 4 if ces08_fed03 == 24025 
replace CA08_district_outcome = 2 if ces08_fed03 == 24026 
replace CA08_district_outcome = 1 if ces08_fed03 == 24027 
replace CA08_district_outcome = 4 if ces08_fed03 == 24028 
replace CA08_district_outcome = 1 if ces08_fed03 == 24029 
replace CA08_district_outcome = 4 if ces08_fed03 == 24030 
replace CA08_district_outcome = 4 if ces08_fed03 == 24031 
replace CA08_district_outcome = 4 if ces08_fed03 == 24032 
replace CA08_district_outcome = 1 if ces08_fed03 == 24033 
replace CA08_district_outcome = 2 if ces08_fed03 == 24034 
replace CA08_district_outcome = 4 if ces08_fed03 == 24035 
replace CA08_district_outcome = 2 if ces08_fed03 == 24036 
replace CA08_district_outcome = 4 if ces08_fed03 == 24037 
replace CA08_district_outcome = 2 if ces08_fed03 == 24038 
replace CA08_district_outcome = 4 if ces08_fed03 == 24039 
replace CA08_district_outcome = 4 if ces08_fed03 == 24040 
replace CA08_district_outcome = 4 if ces08_fed03 == 24041 
replace CA08_district_outcome = 2 if ces08_fed03 == 24042 
replace CA08_district_outcome = 4 if ces08_fed03 == 24043 
replace CA08_district_outcome = 1 if ces08_fed03 == 24044 
replace CA08_district_outcome = 1 if ces08_fed03 == 24045 
replace CA08_district_outcome = 4 if ces08_fed03 == 24046 
replace CA08_district_outcome = 3 if ces08_fed03 == 24047 
replace CA08_district_outcome = 1 if ces08_fed03 == 24048 
replace CA08_district_outcome = 1 if ces08_fed03 == 24049 
replace CA08_district_outcome = 2 if ces08_fed03 == 24050 
replace CA08_district_outcome = 88 if ces08_fed03 == 24051 
replace CA08_district_outcome = 4 if ces08_fed03 == 24052 
replace CA08_district_outcome = 4 if ces08_fed03 == 24053 
replace CA08_district_outcome = 4 if ces08_fed03 == 24054 
replace CA08_district_outcome = 4 if ces08_fed03 == 24055 
replace CA08_district_outcome = 4 if ces08_fed03 == 24056 
replace CA08_district_outcome = 4 if ces08_fed03 == 24057 
replace CA08_district_outcome = 4 if ces08_fed03 == 24058 
replace CA08_district_outcome = 4 if ces08_fed03 == 24059 
replace CA08_district_outcome = 2 if ces08_fed03 == 24060 
replace CA08_district_outcome = 4 if ces08_fed03 == 24061 
replace CA08_district_outcome = 4 if ces08_fed03 == 24062 
replace CA08_district_outcome = 4 if ces08_fed03 == 24063 
replace CA08_district_outcome = 4 if ces08_fed03 == 24064 
replace CA08_district_outcome = 4 if ces08_fed03 == 24065 
replace CA08_district_outcome = 1 if ces08_fed03 == 24066 
replace CA08_district_outcome = 1 if ces08_fed03 == 24067 
replace CA08_district_outcome = 4 if ces08_fed03 == 24068 
replace CA08_district_outcome = 4 if ces08_fed03 == 24069 
replace CA08_district_outcome = 4 if ces08_fed03 == 24070 
replace CA08_district_outcome = 4 if ces08_fed03 == 24071 
replace CA08_district_outcome = 4 if ces08_fed03 == 24072 
replace CA08_district_outcome = 4 if ces08_fed03 == 24073 
replace CA08_district_outcome = 4 if ces08_fed03 == 24074 
replace CA08_district_outcome = 1 if ces08_fed03 == 24075 
replace CA08_district_outcome = 1 if ces08_fed03 == 35001 
replace CA08_district_outcome = 3 if ces08_fed03 == 35002 
replace CA08_district_outcome = 2 if ces08_fed03 == 35003 
replace CA08_district_outcome = 2 if ces08_fed03 == 35004 
replace CA08_district_outcome = 1 if ces08_fed03 == 35005 
replace CA08_district_outcome = 1 if ces08_fed03 == 35006 
replace CA08_district_outcome = 1 if ces08_fed03 == 35007 
replace CA08_district_outcome = 1 if ces08_fed03 == 35008 
replace CA08_district_outcome = 2 if ces08_fed03 == 35009 
replace CA08_district_outcome = 2 if ces08_fed03 == 35010 
replace CA08_district_outcome = 2 if ces08_fed03 == 35011 
replace CA08_district_outcome = 2 if ces08_fed03 == 35012 
replace CA08_district_outcome = 2 if ces08_fed03 == 35013 
replace CA08_district_outcome = 2 if ces08_fed03 == 35014 
replace CA08_district_outcome = 1 if ces08_fed03 == 35015 
replace CA08_district_outcome = 1 if ces08_fed03 == 35016 
replace CA08_district_outcome = 1 if ces08_fed03 == 35017 
replace CA08_district_outcome = 2 if ces08_fed03 == 35018 
replace CA08_district_outcome = 1 if ces08_fed03 == 35019 
replace CA08_district_outcome = 2 if ces08_fed03 == 35020 
replace CA08_district_outcome = 2 if ces08_fed03 == 35021 
replace CA08_district_outcome = 1 if ces08_fed03 == 35022 
replace CA08_district_outcome = 1 if ces08_fed03 == 35023 
replace CA08_district_outcome = 1 if ces08_fed03 == 35024 
replace CA08_district_outcome = 2 if ces08_fed03 == 35025 
replace CA08_district_outcome = 2 if ces08_fed03 == 35026 
replace CA08_district_outcome = 1 if ces08_fed03 == 35027 
replace CA08_district_outcome = 2 if ces08_fed03 == 35028 
replace CA08_district_outcome = 2 if ces08_fed03 == 35029 
replace CA08_district_outcome = 2 if ces08_fed03 == 35030 
replace CA08_district_outcome = 3 if ces08_fed03 == 35031 
replace CA08_district_outcome = 3 if ces08_fed03 == 35032 
replace CA08_district_outcome = 3 if ces08_fed03 == 35033 
replace CA08_district_outcome = 2 if ces08_fed03 == 35034 
replace CA08_district_outcome = 2 if ces08_fed03 == 35035 
replace CA08_district_outcome = 1 if ces08_fed03 == 35036 
replace CA08_district_outcome = 2 if ces08_fed03 == 35037 
replace CA08_district_outcome = 2 if ces08_fed03 == 35038 
replace CA08_district_outcome = 2 if ces08_fed03 == 35039 
replace CA08_district_outcome = 2 if ces08_fed03 == 35040 
replace CA08_district_outcome = 2 if ces08_fed03 == 35041 
replace CA08_district_outcome = 3 if ces08_fed03 == 35042 
replace CA08_district_outcome = 1 if ces08_fed03 == 35043 
replace CA08_district_outcome = 2 if ces08_fed03 == 35044 
replace CA08_district_outcome = 1 if ces08_fed03 == 35045 
replace CA08_district_outcome = 2 if ces08_fed03 == 35046 
replace CA08_district_outcome = 1 if ces08_fed03 == 35047 
replace CA08_district_outcome = 1 if ces08_fed03 == 35048 
replace CA08_district_outcome = 2 if ces08_fed03 == 35049 
replace CA08_district_outcome = 1 if ces08_fed03 == 35050 
replace CA08_district_outcome = 1 if ces08_fed03 == 35051 
replace CA08_district_outcome = 2 if ces08_fed03 == 35052 
replace CA08_district_outcome = 2 if ces08_fed03 == 35053 
replace CA08_district_outcome = 2 if ces08_fed03 == 35054 
replace CA08_district_outcome = 2 if ces08_fed03 == 35055 
replace CA08_district_outcome = 3 if ces08_fed03 == 35056 
replace CA08_district_outcome = 1 if ces08_fed03 == 35057 
replace CA08_district_outcome = 2 if ces08_fed03 == 35058 
replace CA08_district_outcome = 2 if ces08_fed03 == 35059 
replace CA08_district_outcome = 2 if ces08_fed03 == 35060 
replace CA08_district_outcome = 2 if ces08_fed03 == 35061 
replace CA08_district_outcome = 3 if ces08_fed03 == 35062 
replace CA08_district_outcome = 2 if ces08_fed03 == 35063 
replace CA08_district_outcome = 1 if ces08_fed03 == 35064 
replace CA08_district_outcome = 1 if ces08_fed03 == 35065 
replace CA08_district_outcome = 2 if ces08_fed03 == 35066 
replace CA08_district_outcome = 2 if ces08_fed03 == 35067 
replace CA08_district_outcome = 1 if ces08_fed03 == 35068 
replace CA08_district_outcome = 2 if ces08_fed03 == 35069 
replace CA08_district_outcome = 2 if ces08_fed03 == 35070 
replace CA08_district_outcome = 2 if ces08_fed03 == 35071 
replace CA08_district_outcome = 1 if ces08_fed03 == 35072 
replace CA08_district_outcome = 2 if ces08_fed03 == 35073 
replace CA08_district_outcome = 2 if ces08_fed03 == 35074 
replace CA08_district_outcome = 1 if ces08_fed03 == 35075 
replace CA08_district_outcome = 2 if ces08_fed03 == 35076 
replace CA08_district_outcome = 1 if ces08_fed03 == 35077 
replace CA08_district_outcome = 2 if ces08_fed03 == 35078 
replace CA08_district_outcome = 3 if ces08_fed03 == 35079 
replace CA08_district_outcome = 1 if ces08_fed03 == 35080 
replace CA08_district_outcome = 1 if ces08_fed03 == 35081 
replace CA08_district_outcome = 1 if ces08_fed03 == 35082 
replace CA08_district_outcome = 1 if ces08_fed03 == 35083 
replace CA08_district_outcome = 1 if ces08_fed03 == 35084 
replace CA08_district_outcome = 2 if ces08_fed03 == 35085 
replace CA08_district_outcome = 2 if ces08_fed03 == 35086 
replace CA08_district_outcome = 2 if ces08_fed03 == 35087 
replace CA08_district_outcome = 3 if ces08_fed03 == 35088 
replace CA08_district_outcome = 2 if ces08_fed03 == 35089 
replace CA08_district_outcome = 3 if ces08_fed03 == 35090 
replace CA08_district_outcome = 3 if ces08_fed03 == 35091 
replace CA08_district_outcome = 3 if ces08_fed03 == 35092 
replace CA08_district_outcome = 1 if ces08_fed03 == 35093 
replace CA08_district_outcome = 3 if ces08_fed03 == 35094 
replace CA08_district_outcome = 3 if ces08_fed03 == 35095 
replace CA08_district_outcome = 1 if ces08_fed03 == 35096 
replace CA08_district_outcome = 3 if ces08_fed03 == 35097 
replace CA08_district_outcome = 2 if ces08_fed03 == 35098 
replace CA08_district_outcome = 2 if ces08_fed03 == 35099 
replace CA08_district_outcome = 1 if ces08_fed03 == 35100 
replace CA08_district_outcome = 3 if ces08_fed03 == 35101 
replace CA08_district_outcome = 3 if ces08_fed03 == 35102 
replace CA08_district_outcome = 1 if ces08_fed03 == 35103 
replace CA08_district_outcome = 2 if ces08_fed03 == 35104 
replace CA08_district_outcome = 1 if ces08_fed03 == 35105 
replace CA08_district_outcome = 1 if ces08_fed03 == 35106 
replace CA08_district_outcome = 2 if ces08_fed03 == 46001 
replace CA08_district_outcome = 2 if ces08_fed03 == 46002 
replace CA08_district_outcome = 3 if ces08_fed03 == 46003 
replace CA08_district_outcome = 2 if ces08_fed03 == 46004 
replace CA08_district_outcome = 3 if ces08_fed03 == 46005 
replace CA08_district_outcome = 2 if ces08_fed03 == 46006 
replace CA08_district_outcome = 2 if ces08_fed03 == 46007 
replace CA08_district_outcome = 2 if ces08_fed03 == 46008 
replace CA08_district_outcome = 2 if ces08_fed03 == 46009 
replace CA08_district_outcome = 2 if ces08_fed03 == 46010 
replace CA08_district_outcome = 3 if ces08_fed03 == 46011 
replace CA08_district_outcome = 3 if ces08_fed03 == 46012 
replace CA08_district_outcome = 2 if ces08_fed03 == 46013 
replace CA08_district_outcome = 1 if ces08_fed03 == 46014 
replace CA08_district_outcome = 2 if ces08_fed03 == 47001 
replace CA08_district_outcome = 2 if ces08_fed03 == 47002 
replace CA08_district_outcome = 2 if ces08_fed03 == 47003 
replace CA08_district_outcome = 2 if ces08_fed03 == 47004 
replace CA08_district_outcome = 2 if ces08_fed03 == 47005 
replace CA08_district_outcome = 2 if ces08_fed03 == 47006 
replace CA08_district_outcome = 2 if ces08_fed03 == 47007 
replace CA08_district_outcome = 2 if ces08_fed03 == 47008 
replace CA08_district_outcome = 2 if ces08_fed03 == 47009 
replace CA08_district_outcome = 2 if ces08_fed03 == 47010 
replace CA08_district_outcome = 2 if ces08_fed03 == 47011 
replace CA08_district_outcome = 2 if ces08_fed03 == 47012 
replace CA08_district_outcome = 1 if ces08_fed03 == 47013 
replace CA08_district_outcome = 2 if ces08_fed03 == 47014 
replace CA08_district_outcome = 2 if ces08_fed03 == 48001 
replace CA08_district_outcome = 2 if ces08_fed03 == 48002 
replace CA08_district_outcome = 2 if ces08_fed03 == 48003 
replace CA08_district_outcome = 2 if ces08_fed03 == 48004 
replace CA08_district_outcome = 2 if ces08_fed03 == 48005 
replace CA08_district_outcome = 2 if ces08_fed03 == 48006 
replace CA08_district_outcome = 2 if ces08_fed03 == 48007 
replace CA08_district_outcome = 2 if ces08_fed03 == 48008 
replace CA08_district_outcome = 2 if ces08_fed03 == 48009 
replace CA08_district_outcome = 2 if ces08_fed03 == 48010 
replace CA08_district_outcome = 2 if ces08_fed03 == 48011 
replace CA08_district_outcome = 2 if ces08_fed03 == 48012 
replace CA08_district_outcome = 2 if ces08_fed03 == 48013 
replace CA08_district_outcome = 2 if ces08_fed03 == 48014 
replace CA08_district_outcome = 2 if ces08_fed03 == 48015 
replace CA08_district_outcome = 2 if ces08_fed03 == 48016 
replace CA08_district_outcome = 2 if ces08_fed03 == 48017 
replace CA08_district_outcome = 3 if ces08_fed03 == 48018 
replace CA08_district_outcome = 2 if ces08_fed03 == 48019 
replace CA08_district_outcome = 2 if ces08_fed03 == 48020 
replace CA08_district_outcome = 2 if ces08_fed03 == 48021 
replace CA08_district_outcome = 2 if ces08_fed03 == 48022 
replace CA08_district_outcome = 2 if ces08_fed03 == 48023 
replace CA08_district_outcome = 2 if ces08_fed03 == 48024 
replace CA08_district_outcome = 2 if ces08_fed03 == 48025 
replace CA08_district_outcome = 2 if ces08_fed03 == 48026 
replace CA08_district_outcome = 2 if ces08_fed03 == 48027 
replace CA08_district_outcome = 2 if ces08_fed03 == 48028 
replace CA08_district_outcome = 2 if ces08_fed03 == 59001 
replace CA08_district_outcome = 3 if ces08_fed03 == 59002 
replace CA08_district_outcome = 3 if ces08_fed03 == 59003 
replace CA08_district_outcome = 2 if ces08_fed03 == 59004 
replace CA08_district_outcome = 2 if ces08_fed03 == 59005 
replace CA08_district_outcome = 2 if ces08_fed03 == 59006 
replace CA08_district_outcome = 2 if ces08_fed03 == 59007 
replace CA08_district_outcome = 1 if ces08_fed03 == 59008 
replace CA08_district_outcome = 2 if ces08_fed03 == 59009 
replace CA08_district_outcome = 2 if ces08_fed03 == 59010 
replace CA08_district_outcome = 2 if ces08_fed03 == 59011 
replace CA08_district_outcome = 2 if ces08_fed03 == 59012 
replace CA08_district_outcome = 2 if ces08_fed03 == 59013 
replace CA08_district_outcome = 2 if ces08_fed03 == 59014 
replace CA08_district_outcome = 3 if ces08_fed03 == 59015 
replace CA08_district_outcome = 1 if ces08_fed03 == 59016 
replace CA08_district_outcome = 3 if ces08_fed03 == 59017 
replace CA08_district_outcome = 2 if ces08_fed03 == 59018 
replace CA08_district_outcome = 2 if ces08_fed03 == 59019 
replace CA08_district_outcome = 2 if ces08_fed03 == 59020 
replace CA08_district_outcome = 2 if ces08_fed03 == 59021 
replace CA08_district_outcome = 2 if ces08_fed03 == 59022 
replace CA08_district_outcome = 2 if ces08_fed03 == 59023 
replace CA08_district_outcome = 2 if ces08_fed03 == 59024 
replace CA08_district_outcome = 3 if ces08_fed03 == 59025 
replace CA08_district_outcome = 3 if ces08_fed03 == 59026 
replace CA08_district_outcome = 2 if ces08_fed03 == 59027 
replace CA08_district_outcome = 2 if ces08_fed03 == 59028 
replace CA08_district_outcome = 1 if ces08_fed03 == 59029 
replace CA08_district_outcome = 3 if ces08_fed03 == 59030 
replace CA08_district_outcome = 2 if ces08_fed03 == 59031 
replace CA08_district_outcome = 3 if ces08_fed03 == 59032 
replace CA08_district_outcome = 1 if ces08_fed03 == 59033 
replace CA08_district_outcome = 1 if ces08_fed03 == 59034 
replace CA08_district_outcome = 3 if ces08_fed03 == 59035 
replace CA08_district_outcome = 2 if ces08_fed03 == 59036 
replace CA08_district_outcome = 1 if ces08_fed03 == 60001 
replace CA08_district_outcome = 3 if ces08_fed03 == 61001 
replace CA08_district_outcome = 2 if ces08_fed03 == 62001 


********************************************
** COMPETITIVENESS: 2008 FEDERAL ELECTION **
********************************************

* Margin of victory

gen CA08_margin = .

replace CA08_margin = 10.12 if ces08_fed03 == 10001 
replace CA08_margin = 55.04 if ces08_fed03 == 10002 
replace CA08_margin = 50.73 if ces08_fed03 == 10003 
replace CA08_margin = 52.43 if ces08_fed03 == 10004 
replace CA08_margin = 29.92 if ces08_fed03 == 10005 
replace CA08_margin = 61.97 if ces08_fed03 == 10006 
replace CA08_margin = 2.75 if ces08_fed03 == 10007 
replace CA08_margin = 23.22 if ces08_fed03 == 11001 
replace CA08_margin = 17.95 if ces08_fed03 == 11002 
replace CA08_margin = 0.30 if ces08_fed03 == 11003 
replace CA08_margin = 4.91 if ces08_fed03 == 11004 
replace CA08_margin = 24.60 if ces08_fed03 == 12001 
replace CA08_margin = 14.36 if ces08_fed03 == 12002 
replace CA08_margin = 7.94 if ces08_fed03 == 12003 
replace CA08_margin = 15.07 if ces08_fed03 == 12004 
replace CA08_margin = 11.96 if ces08_fed03 == 12005 
replace CA08_margin = 18.04 if ces08_fed03 == 12006 
replace CA08_margin = 56.69 if ces08_fed03 == 12007 
replace CA08_margin = 40.68 if ces08_fed03 == 12008 
replace CA08_margin = 2.34 if ces08_fed03 == 12009 
replace CA08_margin = 24.96 if ces08_fed03 == 12010 
replace CA08_margin = 3.79 if ces08_fed03 == 12011 
replace CA08_margin = 35.61 if ces08_fed03 == 13001 
replace CA08_margin = 17.60 if ces08_fed03 == 13002 
replace CA08_margin = 10.99 if ces08_fed03 == 13003 
replace CA08_margin = 27.91 if ces08_fed03 == 13004 
replace CA08_margin = 14.17 if ces08_fed03 == 13005 
replace CA08_margin = 5.13 if ces08_fed03 == 13006 
replace CA08_margin = 3.30 if ces08_fed03 == 13007 
replace CA08_margin = 38.75 if ces08_fed03 == 13008 
replace CA08_margin = 1.42 if ces08_fed03 == 13009 
replace CA08_margin = 35.89 if ces08_fed03 == 13010 
replace CA08_margin = 27.18 if ces08_fed03 == 24001 
replace CA08_margin = 0.89 if ces08_fed03 == 24002 
replace CA08_margin = 9.56 if ces08_fed03 == 24003 
replace CA08_margin = 29.95 if ces08_fed03 == 24004 
replace CA08_margin = 48.43 if ces08_fed03 == 24005 
replace CA08_margin = 29.86 if ces08_fed03 == 24006 
replace CA08_margin = 4.15 if ces08_fed03 == 24007 
replace CA08_margin = 23.64 if ces08_fed03 == 24008 
replace CA08_margin = 24.37 if ces08_fed03 == 24009 
replace CA08_margin = 2.42 if ces08_fed03 == 24010 
replace CA08_margin = 0.12 if ces08_fed03 == 24011 
replace CA08_margin = 33.30 if ces08_fed03 == 24012 
replace CA08_margin = 11.93 if ces08_fed03 == 24013 
replace CA08_margin = 21.53 if ces08_fed03 == 24014 
replace CA08_margin = 27.22 if ces08_fed03 == 24015 
replace CA08_margin = 6.40 if ces08_fed03 == 24016 
replace CA08_margin = 19.33 if ces08_fed03 == 24017 
replace CA08_margin = 13.48 if ces08_fed03 == 24018 
replace CA08_margin = 13.14 if ces08_fed03 == 24019 
replace CA08_margin = 3.02 if ces08_fed03 == 24020 
replace CA08_margin = 29.06 if ces08_fed03 == 24021 
replace CA08_margin = 15.55 if ces08_fed03 == 24022 
replace CA08_margin = 15.40 if ces08_fed03 == 24023 
replace CA08_margin = 2.65 if ces08_fed03 == 24024 
replace CA08_margin = 34.57 if ces08_fed03 == 24025 
replace CA08_margin = 14.98 if ces08_fed03 == 24026 
replace CA08_margin = 22.88 if ces08_fed03 == 24027 
replace CA08_margin = 40.10 if ces08_fed03 == 24028 
replace CA08_margin = 16.13 if ces08_fed03 == 24029 
replace CA08_margin = 20.40 if ces08_fed03 == 24030 
replace CA08_margin = 31.90 if ces08_fed03 == 24031 
replace CA08_margin = 9.70 if ces08_fed03 == 24032 
replace CA08_margin = 16.90 if ces08_fed03 == 24033 
replace CA08_margin = 20.44 if ces08_fed03 == 24034 
replace CA08_margin = 24.33 if ces08_fed03 == 24035 
replace CA08_margin = 22.69 if ces08_fed03 == 24036 
replace CA08_margin = 8.02 if ces08_fed03 == 24037 
replace CA08_margin = 20.61 if ces08_fed03 == 24038 
replace CA08_margin = 22.26 if ces08_fed03 == 24039 
replace CA08_margin = 21.07 if ces08_fed03 == 24040 
replace CA08_margin = 1.93 if ces08_fed03 == 24041 
replace CA08_margin = 18.98 if ces08_fed03 == 24042 
replace CA08_margin = 41.76 if ces08_fed03 == 24043 
replace CA08_margin = 28.32 if ces08_fed03 == 24044 
replace CA08_margin = 28.40 if ces08_fed03 == 24045 
replace CA08_margin = 9.28 if ces08_fed03 == 24046 
replace CA08_margin = 6.45 if ces08_fed03 == 24047 
replace CA08_margin = 2.78 if ces08_fed03 == 24048 
replace CA08_margin = 21.11 if ces08_fed03 == 24049 
replace CA08_margin = 8.46 if ces08_fed03 == 24050 
replace CA08_margin = 1.47 if ces08_fed03 == 24051 
replace CA08_margin = 16.10 if ces08_fed03 == 24052 
replace CA08_margin = 37.90 if ces08_fed03 == 24053 
replace CA08_margin = 36.52 if ces08_fed03 == 24054 
replace CA08_margin = 17.00 if ces08_fed03 == 24055 
replace CA08_margin = 24.60 if ces08_fed03 == 24056 
replace CA08_margin = 26.18 if ces08_fed03 == 24057 
replace CA08_margin = 15.39 if ces08_fed03 == 24058 
replace CA08_margin = 39.09 if ces08_fed03 == 24059 
replace CA08_margin = 3.89 if ces08_fed03 == 24060 
replace CA08_margin = 33.33 if ces08_fed03 == 24061 
replace CA08_margin = 22.74 if ces08_fed03 == 24062 
replace CA08_margin = 26.11 if ces08_fed03 == 24063 
replace CA08_margin = 31.96 if ces08_fed03 == 24064 
replace CA08_margin = 9.13 if ces08_fed03 == 24065 
replace CA08_margin = 44.51 if ces08_fed03 == 24066 
replace CA08_margin = 42.38 if ces08_fed03 == 24067 
replace CA08_margin = 20.07 if ces08_fed03 == 24068 
replace CA08_margin = 21.44 if ces08_fed03 == 24069 
replace CA08_margin = 30.55 if ces08_fed03 == 24070 
replace CA08_margin = 35.82 if ces08_fed03 == 24071 
replace CA08_margin = 21.03 if ces08_fed03 == 24072 
replace CA08_margin = 17.65 if ces08_fed03 == 24073 
replace CA08_margin = 34.51 if ces08_fed03 == 24074 
replace CA08_margin = 23.54 if ces08_fed03 == 24075 
replace CA08_margin = 6.58 if ces08_fed03 == 35001 
replace CA08_margin = 12.97 if ces08_fed03 == 35002 
replace CA08_margin = 19.40 if ces08_fed03 == 35003 
replace CA08_margin = 28.49 if ces08_fed03 == 35004 
replace CA08_margin = 8.84 if ces08_fed03 == 35005 
replace CA08_margin = 7.93 if ces08_fed03 == 35006 
replace CA08_margin = 1.71 if ces08_fed03 == 35007 
replace CA08_margin = 0.43 if ces08_fed03 == 35008 
replace CA08_margin = 8.84 if ces08_fed03 == 35009 
replace CA08_margin = 15.35 if ces08_fed03 == 35010 
replace CA08_margin = 25.24 if ces08_fed03 == 35011 
replace CA08_margin = 35.42 if ces08_fed03 == 35012 
replace CA08_margin = 18.80 if ces08_fed03 == 35013 
replace CA08_margin = 31.02 if ces08_fed03 == 35014 
replace CA08_margin = 14.51 if ces08_fed03 == 35015 
replace CA08_margin = 17.08 if ces08_fed03 == 35016 
replace CA08_margin = 5.53 if ces08_fed03 == 35017 
replace CA08_margin = 33.86 if ces08_fed03 == 35018 
replace CA08_margin = 4.74 if ces08_fed03 == 35019 
replace CA08_margin = 24.86 if ces08_fed03 == 35020 
replace CA08_margin = 10.94 if ces08_fed03 == 35021 
replace CA08_margin = 11.34 if ces08_fed03 == 35022 
replace CA08_margin = 11.26 if ces08_fed03 == 35023 
replace CA08_margin = 18.51 if ces08_fed03 == 35024 
replace CA08_margin = 10.43 if ces08_fed03 == 35025 
replace CA08_margin = 20.49 if ces08_fed03 == 35026 
replace CA08_margin = 3.04 if ces08_fed03 == 35027 
replace CA08_margin = 8.48 if ces08_fed03 == 35028 
replace CA08_margin = 35.53 if ces08_fed03 == 35029 
replace CA08_margin = 11.31 if ces08_fed03 == 35030 
replace CA08_margin = 26.97 if ces08_fed03 == 35031 
replace CA08_margin = 13.39 if ces08_fed03 == 35032 
replace CA08_margin = 12.99 if ces08_fed03 == 35033 
replace CA08_margin = 11.80 if ces08_fed03 == 35034 
replace CA08_margin = 8.83 if ces08_fed03 == 35035 
replace CA08_margin = 6.61 if ces08_fed03 == 35036 
replace CA08_margin = 0.76 if ces08_fed03 == 35037 
replace CA08_margin = 24.42 if ces08_fed03 == 35038 
replace CA08_margin = 0.03 if ces08_fed03 == 35039 
replace CA08_margin = 34.08 if ces08_fed03 == 35040 
replace CA08_margin = 41.26 if ces08_fed03 == 35041 
replace CA08_margin = 12.21 if ces08_fed03 == 35042 
replace CA08_margin = 6.16 if ces08_fed03 == 35043 
replace CA08_margin = 3.67 if ces08_fed03 == 35044 
replace CA08_margin = 24.89 if ces08_fed03 == 35045 
replace CA08_margin = 26.57 if ces08_fed03 == 35046 
replace CA08_margin = 14.73 if ces08_fed03 == 35047 
replace CA08_margin = 17.60 if ces08_fed03 == 35048 
replace CA08_margin = 0.71 if ces08_fed03 == 35049 
replace CA08_margin = 4.63 if ces08_fed03 == 35050 
replace CA08_margin = 9.96 if ces08_fed03 == 35051 
replace CA08_margin = 32.42 if ces08_fed03 == 35052 
replace CA08_margin = 12.43 if ces08_fed03 == 35053 
replace CA08_margin = 19.73 if ces08_fed03 == 35054 
replace CA08_margin = 28.01 if ces08_fed03 == 35055 
replace CA08_margin = 20.24 if ces08_fed03 == 35056 
replace CA08_margin = 12.22 if ces08_fed03 == 35057 
replace CA08_margin = 20.12 if ces08_fed03 == 35058 
replace CA08_margin = 0.72 if ces08_fed03 == 35059 
replace CA08_margin = 9.90 if ces08_fed03 == 35060 
replace CA08_margin = 6.64 if ces08_fed03 == 35061 
replace CA08_margin = 13.72 if ces08_fed03 == 35062 
replace CA08_margin = 6.09 if ces08_fed03 == 35063 
replace CA08_margin = 16.53 if ces08_fed03 == 35064 
replace CA08_margin = 18.92 if ces08_fed03 == 35065 
replace CA08_margin = 8.86 if ces08_fed03 == 35066 
replace CA08_margin = 33.29 if ces08_fed03 == 35067 
replace CA08_margin = 7.01 if ces08_fed03 == 35068 
replace CA08_margin = 25.20 if ces08_fed03 == 35069 
replace CA08_margin = 24.41 if ces08_fed03 == 35070 
replace CA08_margin = 15.80 if ces08_fed03 == 35071 
replace CA08_margin = 17.24 if ces08_fed03 == 35072 
replace CA08_margin = 23.13 if ces08_fed03 == 35073 
replace CA08_margin = 40.52 if ces08_fed03 == 35074 
replace CA08_margin = 11.31 if ces08_fed03 == 35075 
replace CA08_margin = 17.25 if ces08_fed03 == 35076 
replace CA08_margin = 23.75 if ces08_fed03 == 35077 
replace CA08_margin = 28.37 if ces08_fed03 == 35078 
replace CA08_margin = 2.71 if ces08_fed03 == 35079 
replace CA08_margin = 27.22 if ces08_fed03 == 35080 
replace CA08_margin = 18.57 if ces08_fed03 == 35081 
replace CA08_margin = 20.01 if ces08_fed03 == 35082 
replace CA08_margin = 36.08 if ces08_fed03 == 35083 
replace CA08_margin = 12.31 if ces08_fed03 == 35084 
replace CA08_margin = 33.49 if ces08_fed03 == 35085 
replace CA08_margin = 21.99 if ces08_fed03 == 35086 
replace CA08_margin = 38.36 if ces08_fed03 == 35087 
replace CA08_margin = 4.95 if ces08_fed03 == 35088 
replace CA08_margin = 9.58 if ces08_fed03 == 35089 
replace CA08_margin = 8.05 if ces08_fed03 == 35090 
replace CA08_margin = 8.72 if ces08_fed03 == 35091 
replace CA08_margin = 34.37 if ces08_fed03 == 35092 
replace CA08_margin = 35.20 if ces08_fed03 == 35093 
replace CA08_margin = 15.40 if ces08_fed03 == 35094 
replace CA08_margin = 5.82 if ces08_fed03 == 35095 
replace CA08_margin = 14.85 if ces08_fed03 == 35096 
replace CA08_margin = 0.59 if ces08_fed03 == 35097 
replace CA08_margin = 35.30 if ces08_fed03 == 35098 
replace CA08_margin = 25.31 if ces08_fed03 == 35099 
replace CA08_margin = 16.21 if ces08_fed03 == 35100 
replace CA08_margin = 24.77 if ces08_fed03 == 35101 
replace CA08_margin = 29.90 if ces08_fed03 == 35102 
replace CA08_margin = 5.46 if ces08_fed03 == 35103 
replace CA08_margin = 37.99 if ces08_fed03 == 35104 
replace CA08_margin = 18.65 if ces08_fed03 == 35105 
replace CA08_margin = 40.65 if ces08_fed03 == 35106 
replace CA08_margin = 39.39 if ces08_fed03 == 46001 
replace CA08_margin = 32.60 if ces08_fed03 == 46002 
replace CA08_margin = 18.72 if ces08_fed03 == 46003 
replace CA08_margin = 44.73 if ces08_fed03 == 46004 
replace CA08_margin = 5.03 if ces08_fed03 == 46005 
replace CA08_margin = 20.70 if ces08_fed03 == 46006 
replace CA08_margin = 54.72 if ces08_fed03 == 46007 
replace CA08_margin = 50.93 if ces08_fed03 == 46008 
replace CA08_margin = 11.23 if ces08_fed03 == 46009 
replace CA08_margin = 35.90 if ces08_fed03 == 46010 
replace CA08_margin = 27.27 if ces08_fed03 == 46011 
replace CA08_margin = 40.26 if ces08_fed03 == 46012 
replace CA08_margin = 14.04 if ces08_fed03 == 46013 
replace CA08_margin = 6.01 if ces08_fed03 == 46014 
replace CA08_margin = 34.82 if ces08_fed03 == 47001 
replace CA08_margin = 28.27 if ces08_fed03 == 47002 
replace CA08_margin = 16.39 if ces08_fed03 == 47003 
replace CA08_margin = 48.58 if ces08_fed03 == 47004 
replace CA08_margin = 10.27 if ces08_fed03 == 47005 
replace CA08_margin = 28.96 if ces08_fed03 == 47006 
replace CA08_margin = 22.56 if ces08_fed03 == 47007 
replace CA08_margin = 19.79 if ces08_fed03 == 47008 
replace CA08_margin = 25.95 if ces08_fed03 == 47009 
replace CA08_margin = 0.97 if ces08_fed03 == 47010 
replace CA08_margin = 32.15 if ces08_fed03 == 47011 
replace CA08_margin = 53.69 if ces08_fed03 == 47012 
replace CA08_margin = 11.44 if ces08_fed03 == 47013 
replace CA08_margin = 47.18 if ces08_fed03 == 47014 
replace CA08_margin = 54.21 if ces08_fed03 == 48001 
replace CA08_margin = 54.72 if ces08_fed03 == 48002 
replace CA08_margin = 41.22 if ces08_fed03 == 48003 
replace CA08_margin = 31.28 if ces08_fed03 == 48004 
replace CA08_margin = 56.39 if ces08_fed03 == 48005 
replace CA08_margin = 37.69 if ces08_fed03 == 48006 
replace CA08_margin = 63.66 if ces08_fed03 == 48007 
replace CA08_margin = 63.65 if ces08_fed03 == 48008 
replace CA08_margin = 35.46 if ces08_fed03 == 48009 
replace CA08_margin = 74.14 if ces08_fed03 == 48010 
replace CA08_margin = 41.81 if ces08_fed03 == 48011 
replace CA08_margin = 21.61 if ces08_fed03 == 48012 
replace CA08_margin = 19.51 if ces08_fed03 == 48013 
replace CA08_margin = 45.62 if ces08_fed03 == 48014 
replace CA08_margin = 45.87 if ces08_fed03 == 48015 
replace CA08_margin = 3.39 if ces08_fed03 == 48016 
replace CA08_margin = 56.07 if ces08_fed03 == 48017 
replace CA08_margin = 0.98 if ces08_fed03 == 48018 
replace CA08_margin = 52.74 if ces08_fed03 == 48019 
replace CA08_margin = 68.25 if ces08_fed03 == 48020 
replace CA08_margin = 59.86 if ces08_fed03 == 48021 
replace CA08_margin = 55.10 if ces08_fed03 == 48022 
replace CA08_margin = 62.13 if ces08_fed03 == 48023 
replace CA08_margin = 67.64 if ces08_fed03 == 48024 
replace CA08_margin = 62.58 if ces08_fed03 == 48025 
replace CA08_margin = 68.52 if ces08_fed03 == 48026 
replace CA08_margin = 60.28 if ces08_fed03 == 48027 
replace CA08_margin = 59.58 if ces08_fed03 == 48028 
replace CA08_margin = 47.04 if ces08_fed03 == 59001 
replace CA08_margin = 1.69 if ces08_fed03 == 59002 
replace CA08_margin = 16.15 if ces08_fed03 == 59003 
replace CA08_margin = 29.50 if ces08_fed03 == 59004 
replace CA08_margin = 43.56 if ces08_fed03 == 59005 
replace CA08_margin = 33.73 if ces08_fed03 == 59006 
replace CA08_margin = 18.80 if ces08_fed03 == 59007 
replace CA08_margin = 0.11 if ces08_fed03 == 59008 
replace CA08_margin = 18.57 if ces08_fed03 == 59009 
replace CA08_margin = 10.27 if ces08_fed03 == 59010 
replace CA08_margin = 40.82 if ces08_fed03 == 59011 
replace CA08_margin = 36.95 if ces08_fed03 == 59012 
replace CA08_margin = 44.68 if ces08_fed03 == 59013 
replace CA08_margin = 14.93 if ces08_fed03 == 59014 
replace CA08_margin = 7.58 if ces08_fed03 == 59015 
replace CA08_margin = 5.51 if ces08_fed03 == 59016 
replace CA08_margin = 2.99 if ces08_fed03 == 59017 
replace CA08_margin = 32.02 if ces08_fed03 == 59018 
replace CA08_margin = 4.89 if ces08_fed03 == 59019 
replace CA08_margin = 41.49 if ces08_fed03 == 59020 
replace CA08_margin = 32.33 if ces08_fed03 == 59021 
replace CA08_margin = 46.01 if ces08_fed03 == 59022 
replace CA08_margin = 18.98 if ces08_fed03 == 59023 
replace CA08_margin = 4.07 if ces08_fed03 == 59024 
replace CA08_margin = 13.48 if ces08_fed03 == 59025 
replace CA08_margin = 11.66 if ces08_fed03 == 59026 
replace CA08_margin = 35.75 if ces08_fed03 == 59027 
replace CA08_margin = 3.17 if ces08_fed03 == 59028 
replace CA08_margin = 9.41 if ces08_fed03 == 59029 
replace CA08_margin = 37.17 if ces08_fed03 == 59030 
replace CA08_margin = 4.40 if ces08_fed03 == 59031 
replace CA08_margin = 6.12 if ces08_fed03 == 59032 
replace CA08_margin = 8.67 if ces08_fed03 == 59033 
replace CA08_margin = 0.05 if ces08_fed03 == 59034 
replace CA08_margin = 17.05 if ces08_fed03 == 59035 
replace CA08_margin = 18.00 if ces08_fed03 == 59036 
replace CA08_margin = 13.14 if ces08_fed03 == 60001 
replace CA08_margin = 3.82 if ces08_fed03 == 61001 
replace CA08_margin = 5.78 if ces08_fed03 == 62001 

* Effective number of electoral parties

gen CA08_enep = .

replace CA08_enep = 2.782975 if ces08_fed03 == 10001 
replace CA08_enep = 1.876072 if ces08_fed03 == 10002 
replace CA08_enep = 1.966081 if ces08_fed03 == 10003 
replace CA08_enep = 1.873814 if ces08_fed03 == 10004 
replace CA08_enep = 2.579681 if ces08_fed03 == 10005 
replace CA08_enep = 1.722274 if ces08_fed03 == 10006 
replace CA08_enep = 2.713382 if ces08_fed03 == 10007 
replace CA08_enep = 2.647332 if ces08_fed03 == 11001 
replace CA08_enep = 2.693668 if ces08_fed03 == 11002 
replace CA08_enep = 2.546592 if ces08_fed03 == 11003 
replace CA08_enep = 2.750091 if ces08_fed03 == 11004 
replace CA08_enep = 2.971845 if ces08_fed03 == 12001 
replace CA08_enep = 2.781331 if ces08_fed03 == 12002 
replace CA08_enep = 3.230885 if ces08_fed03 == 12003 
replace CA08_enep = 3.240188 if ces08_fed03 == 12004 
replace CA08_enep = 3.22541 if ces08_fed03 == 12005 
replace CA08_enep = 3.162074 if ces08_fed03 == 12006 
replace CA08_enep = 1.974152 if ces08_fed03 == 12007 
replace CA08_enep = 2.277841 if ces08_fed03 == 12008 
replace CA08_enep = 3.30533 if ces08_fed03 == 12009 
replace CA08_enep = 2.862418 if ces08_fed03 == 12010 
replace CA08_enep = 3.109029 if ces08_fed03 == 12011 
replace CA08_enep = 2.41665 if ces08_fed03 == 13001 
replace CA08_enep = 2.964212 if ces08_fed03 == 13002 
replace CA08_enep = 3.181271 if ces08_fed03 == 13003 
replace CA08_enep = 2.791731 if ces08_fed03 == 13004 
replace CA08_enep = 2.77082 if ces08_fed03 == 13005 
replace CA08_enep = 2.90387 if ces08_fed03 == 13006 
replace CA08_enep = 3.167968 if ces08_fed03 == 13007 
replace CA08_enep = 2.445572 if ces08_fed03 == 13008 
replace CA08_enep = 3.027459 if ces08_fed03 == 13009 
replace CA08_enep = 2.483967 if ces08_fed03 == 13010 
replace CA08_enep = 3.1455 if ces08_fed03 == 24001 
replace CA08_enep = 3.08274 if ces08_fed03 == 24002 
replace CA08_enep = 3.592409 if ces08_fed03 == 24003 
replace CA08_enep = 3.210667 if ces08_fed03 == 24004 
replace CA08_enep = 2.329756 if ces08_fed03 == 24005 
replace CA08_enep = 3.047614 if ces08_fed03 == 24006 
replace CA08_enep = 3.597403 if ces08_fed03 == 24007 
replace CA08_enep = 3.277094 if ces08_fed03 == 24008 
replace CA08_enep = 2.957444 if ces08_fed03 == 24009 
replace CA08_enep = 3.62536 if ces08_fed03 == 24010 
replace CA08_enep = 3.782559 if ces08_fed03 == 24011 
replace CA08_enep = 3.093288 if ces08_fed03 == 24012 
replace CA08_enep = 3.421404 if ces08_fed03 == 24013 
replace CA08_enep = 2.955843 if ces08_fed03 == 24014 
replace CA08_enep = 3.368045 if ces08_fed03 == 24015 
replace CA08_enep = 3.150911 if ces08_fed03 == 24016 
replace CA08_enep = 3.585447 if ces08_fed03 == 24017 
replace CA08_enep = 3.691593 if ces08_fed03 == 24018 
replace CA08_enep = 3.430638 if ces08_fed03 == 24019 
replace CA08_enep = 4.059808 if ces08_fed03 == 24020 
replace CA08_enep = 3.112711 if ces08_fed03 == 24021 
replace CA08_enep = 3.28737 if ces08_fed03 == 24022 
replace CA08_enep = 3.937487 if ces08_fed03 == 24023 
replace CA08_enep = 3.765998 if ces08_fed03 == 24024 
replace CA08_enep = 2.935563 if ces08_fed03 == 24025 
replace CA08_enep = 2.374881 if ces08_fed03 == 24026 
replace CA08_enep = 3.267658 if ces08_fed03 == 24027 
replace CA08_enep = 2.701257 if ces08_fed03 == 24028 
replace CA08_enep = 3.708997 if ces08_fed03 == 24029 
replace CA08_enep = 3.125615 if ces08_fed03 == 24030 
replace CA08_enep = 3.086121 if ces08_fed03 == 24031 
replace CA08_enep = 3.69177 if ces08_fed03 == 24032 
replace CA08_enep = 3.624346 if ces08_fed03 == 24033 
replace CA08_enep = 3.219755 if ces08_fed03 == 24034 
replace CA08_enep = 3.314313 if ces08_fed03 == 24035 
replace CA08_enep = 3.149064 if ces08_fed03 == 24036 
replace CA08_enep = 3.625943 if ces08_fed03 == 24037 
replace CA08_enep = 3.105578 if ces08_fed03 == 24038 
replace CA08_enep = 2.915509 if ces08_fed03 == 24039 
replace CA08_enep = 3.301577 if ces08_fed03 == 24040 
replace CA08_enep = 3.292258 if ces08_fed03 == 24041 
replace CA08_enep = 3.088014 if ces08_fed03 == 24042 
replace CA08_enep = 2.719141 if ces08_fed03 == 24043 
replace CA08_enep = 2.536699 if ces08_fed03 == 24044 
replace CA08_enep = 3.576596 if ces08_fed03 == 24045 
replace CA08_enep = 3.433615 if ces08_fed03 == 24046 
replace CA08_enep = 3.396893 if ces08_fed03 == 24047 
replace CA08_enep = 2.976428 if ces08_fed03 == 24048 
replace CA08_enep = 3.204633 if ces08_fed03 == 24049 
replace CA08_enep = 4.13166 if ces08_fed03 == 24050 
replace CA08_enep = 3.863423 if ces08_fed03 == 24051 
replace CA08_enep = 3.497757 if ces08_fed03 == 24052 
replace CA08_enep = 2.880609 if ces08_fed03 == 24053 
replace CA08_enep = 2.73417 if ces08_fed03 == 24054 
replace CA08_enep = 3.120847 if ces08_fed03 == 24055 
replace CA08_enep = 3.485571 if ces08_fed03 == 24056 
replace CA08_enep = 3.376383 if ces08_fed03 == 24057 
replace CA08_enep = 3.004948 if ces08_fed03 == 24058 
replace CA08_enep = 2.869516 if ces08_fed03 == 24059 
replace CA08_enep = 2.780987 if ces08_fed03 == 24060 
replace CA08_enep = 2.947126 if ces08_fed03 == 24061 
replace CA08_enep = 3.385488 if ces08_fed03 == 24062 
replace CA08_enep = 3.230776 if ces08_fed03 == 24063 
replace CA08_enep = 3.126195 if ces08_fed03 == 24064 
replace CA08_enep = 3.703327 if ces08_fed03 == 24065 
replace CA08_enep = 2.317225 if ces08_fed03 == 24066 
replace CA08_enep = 2.62632 if ces08_fed03 == 24067 
replace CA08_enep = 3.314959 if ces08_fed03 == 24068 
replace CA08_enep = 3.51384 if ces08_fed03 == 24069 
replace CA08_enep = 3.003188 if ces08_fed03 == 24070 
replace CA08_enep = 2.940817 if ces08_fed03 == 24071 
replace CA08_enep = 3.265695 if ces08_fed03 == 24072 
replace CA08_enep = 3.528584 if ces08_fed03 == 24073 
replace CA08_enep = 3.026345 if ces08_fed03 == 24074 
replace CA08_enep = 3.292142 if ces08_fed03 == 24075 
replace CA08_enep = 2.809497 if ces08_fed03 == 35001 
replace CA08_enep = 2.891241 if ces08_fed03 == 35002 
replace CA08_enep = 3.058347 if ces08_fed03 == 35003 
replace CA08_enep = 2.792838 if ces08_fed03 == 35004 
replace CA08_enep = 3.233542 if ces08_fed03 == 35005 
replace CA08_enep = 2.792685 if ces08_fed03 == 35006 
replace CA08_enep = 2.919317 if ces08_fed03 == 35007 
replace CA08_enep = 2.905669 if ces08_fed03 == 35008 
replace CA08_enep = 3.122437 if ces08_fed03 == 35009 
replace CA08_enep = 2.746234 if ces08_fed03 == 35010 
replace CA08_enep = 2.970177 if ces08_fed03 == 35011 
replace CA08_enep = 2.478636 if ces08_fed03 == 35012 
replace CA08_enep = 2.892444 if ces08_fed03 == 35013 
replace CA08_enep = 2.70886 if ces08_fed03 == 35014 
replace CA08_enep = 3.026706 if ces08_fed03 == 35015 
replace CA08_enep = 2.8585 if ces08_fed03 == 35016 
replace CA08_enep = 2.763036 if ces08_fed03 == 35017 
replace CA08_enep = 2.786921 if ces08_fed03 == 35018 
replace CA08_enep = 2.765384 if ces08_fed03 == 35019 
replace CA08_enep = 3.017438 if ces08_fed03 == 35020 
replace CA08_enep = 3.153699 if ces08_fed03 == 35021 
replace CA08_enep = 2.570252 if ces08_fed03 == 35022 
replace CA08_enep = 2.833911 if ces08_fed03 == 35023 
replace CA08_enep = 2.829244 if ces08_fed03 == 35024 
replace CA08_enep = 2.677349 if ces08_fed03 == 35025 
replace CA08_enep = 3.022564 if ces08_fed03 == 35026 
replace CA08_enep = 3.832829 if ces08_fed03 == 35027 
replace CA08_enep = 3.371758 if ces08_fed03 == 35028 
replace CA08_enep = 2.610347 if ces08_fed03 == 35029 
replace CA08_enep = 2.70775 if ces08_fed03 == 35030 
replace CA08_enep = 3.017296 if ces08_fed03 == 35031 
replace CA08_enep = 3.248031 if ces08_fed03 == 35032 
replace CA08_enep = 3.046313 if ces08_fed03 == 35033 
replace CA08_enep = 2.988221 if ces08_fed03 == 35034 
replace CA08_enep = 3.125973 if ces08_fed03 == 35035 
replace CA08_enep = 3.317248 if ces08_fed03 == 35036 
replace CA08_enep = 3.291043 if ces08_fed03 == 35037 
replace CA08_enep = 2.946357 if ces08_fed03 == 35038 
replace CA08_enep = 3.375801 if ces08_fed03 == 35039 
replace CA08_enep = 2.601644 if ces08_fed03 == 35040 
replace CA08_enep = 2.502765 if ces08_fed03 == 35041 
replace CA08_enep = 3.118257 if ces08_fed03 == 35042 
replace CA08_enep = 3.297975 if ces08_fed03 == 35043 
replace CA08_enep = 3.235347 if ces08_fed03 == 35044 
replace CA08_enep = 2.465263 if ces08_fed03 == 35045 
replace CA08_enep = 2.829837 if ces08_fed03 == 35046 
replace CA08_enep = 2.820477 if ces08_fed03 == 35047 
replace CA08_enep = 2.678704 if ces08_fed03 == 35048 
replace CA08_enep = 2.700017 if ces08_fed03 == 35049 
replace CA08_enep = 2.735997 if ces08_fed03 == 35050 
replace CA08_enep = 2.840303 if ces08_fed03 == 35051 
replace CA08_enep = 2.575646 if ces08_fed03 == 35052 
replace CA08_enep = 2.857384 if ces08_fed03 == 35053 
replace CA08_enep = 3.031229 if ces08_fed03 == 35054 
replace CA08_enep = 2.816185 if ces08_fed03 == 35055 
replace CA08_enep = 2.981558 if ces08_fed03 == 35056 
replace CA08_enep = 3.00424 if ces08_fed03 == 35057 
replace CA08_enep = 2.883813 if ces08_fed03 == 35058 
replace CA08_enep = 2.744784 if ces08_fed03 == 35059 
replace CA08_enep = 2.695731 if ces08_fed03 == 35060 
replace CA08_enep = 3.101177 if ces08_fed03 == 35061 
replace CA08_enep = 3.435448 if ces08_fed03 == 35062 
replace CA08_enep = 2.730226 if ces08_fed03 == 35063 
replace CA08_enep = 2.685315 if ces08_fed03 == 35064 
replace CA08_enep = 3.083003 if ces08_fed03 == 35065 
replace CA08_enep = 2.855705 if ces08_fed03 == 35066 
replace CA08_enep = 2.825811 if ces08_fed03 == 35067 
replace CA08_enep = 2.983165 if ces08_fed03 == 35068 
replace CA08_enep = 2.911914 if ces08_fed03 == 35069 
replace CA08_enep = 3.080208 if ces08_fed03 == 35070 
replace CA08_enep = 2.867907 if ces08_fed03 == 35071 
replace CA08_enep = 2.719122 if ces08_fed03 == 35072 
replace CA08_enep = 2.846964 if ces08_fed03 == 35073 
replace CA08_enep = 2.313397 if ces08_fed03 == 35074 
replace CA08_enep = 2.750506 if ces08_fed03 == 35075 
replace CA08_enep = 3.017879 if ces08_fed03 == 35076 
replace CA08_enep = 2.832371 if ces08_fed03 == 35077 
replace CA08_enep = 2.915817 if ces08_fed03 == 35078 
replace CA08_enep = 2.9785 if ces08_fed03 == 35079 
replace CA08_enep = 2.392228 if ces08_fed03 == 35080 
replace CA08_enep = 2.81355 if ces08_fed03 == 35081 
replace CA08_enep = 2.731314 if ces08_fed03 == 35082 
replace CA08_enep = 2.383009 if ces08_fed03 == 35083 
replace CA08_enep = 3.264805 if ces08_fed03 == 35084 
replace CA08_enep = 2.683316 if ces08_fed03 == 35085 
replace CA08_enep = 2.865991 if ces08_fed03 == 35086 
replace CA08_enep = 2.575996 if ces08_fed03 == 35087 
replace CA08_enep = 3.479917 if ces08_fed03 == 35088 
replace CA08_enep = 2.484514 if ces08_fed03 == 35089 
replace CA08_enep = 3.088573 if ces08_fed03 == 35090 
replace CA08_enep = 3.399905 if ces08_fed03 == 35091 
replace CA08_enep = 2.481739 if ces08_fed03 == 35092 
replace CA08_enep = 2.801148 if ces08_fed03 == 35093 
replace CA08_enep = 3.145697 if ces08_fed03 == 35094 
replace CA08_enep = 3.157671 if ces08_fed03 == 35095 
replace CA08_enep = 2.675891 if ces08_fed03 == 35096 
replace CA08_enep = 3.40221 if ces08_fed03 == 35097 
replace CA08_enep = 2.496668 if ces08_fed03 == 35098 
replace CA08_enep = 2.829557 if ces08_fed03 == 35099 
replace CA08_enep = 2.800534 if ces08_fed03 == 35100 
replace CA08_enep = 2.919677 if ces08_fed03 == 35101 
replace CA08_enep = 2.742513 if ces08_fed03 == 35102 
replace CA08_enep = 2.840289 if ces08_fed03 == 35103 
replace CA08_enep = 2.619116 if ces08_fed03 == 35104 
replace CA08_enep = 2.947071 if ces08_fed03 == 35105 
replace CA08_enep = 2.390273 if ces08_fed03 == 35106 
replace CA08_enep = 2.573124 if ces08_fed03 == 46001 
replace CA08_enep = 2.693166 if ces08_fed03 == 46002 
replace CA08_enep = 2.849398 if ces08_fed03 == 46003 
replace CA08_enep = 2.336072 if ces08_fed03 == 46004 
replace CA08_enep = 2.608299 if ces08_fed03 == 46005 
replace CA08_enep = 2.494614 if ces08_fed03 == 46006 
replace CA08_enep = 2.011823 if ces08_fed03 == 46007 
replace CA08_enep = 2.187401 if ces08_fed03 == 46008 
replace CA08_enep = 2.797959 if ces08_fed03 == 46009 
replace CA08_enep = 2.278874 if ces08_fed03 == 46010 
replace CA08_enep = 3.095759 if ces08_fed03 == 46011 
replace CA08_enep = 2.20862 if ces08_fed03 == 46012 
replace CA08_enep = 2.668314 if ces08_fed03 == 46013 
replace CA08_enep = 2.980681 if ces08_fed03 == 46014 
replace CA08_enep = 2.300412 if ces08_fed03 == 47001 
replace CA08_enep = 2.623284 if ces08_fed03 == 47002 
replace CA08_enep = 2.917584 if ces08_fed03 == 47003 
replace CA08_enep = 2.168975 if ces08_fed03 == 47004 
replace CA08_enep = 2.9334 if ces08_fed03 == 47005 
replace CA08_enep = 2.353524 if ces08_fed03 == 47006 
replace CA08_enep = 2.720681 if ces08_fed03 == 47007 
replace CA08_enep = 2.593212 if ces08_fed03 == 47008 
replace CA08_enep = 2.59475 if ces08_fed03 == 47009 
replace CA08_enep = 2.454446 if ces08_fed03 == 47010 
replace CA08_enep = 2.50888 if ces08_fed03 == 47011 
replace CA08_enep = 1.875479 if ces08_fed03 == 47012 
replace CA08_enep = 2.809339 if ces08_fed03 == 47013 
replace CA08_enep = 1.951343 if ces08_fed03 == 47014 
replace CA08_enep = 2.071278 if ces08_fed03 == 48001 
replace CA08_enep = 2.095146 if ces08_fed03 == 48002 
replace CA08_enep = 2.628768 if ces08_fed03 == 48003 
replace CA08_enep = 2.986401 if ces08_fed03 == 48004 
replace CA08_enep = 1.93425 if ces08_fed03 == 48005 
replace CA08_enep = 2.653213 if ces08_fed03 == 48006 
replace CA08_enep = 1.756967 if ces08_fed03 == 48007 
replace CA08_enep = 1.80142 if ces08_fed03 == 48008 
replace CA08_enep = 2.535857 if ces08_fed03 == 48009 
replace CA08_enep = 1.461198 if ces08_fed03 == 48010 
replace CA08_enep = 2.357299 if ces08_fed03 == 48011 
replace CA08_enep = 2.900354 if ces08_fed03 == 48012 
replace CA08_enep = 2.631325 if ces08_fed03 == 48013 
replace CA08_enep = 2.22427 if ces08_fed03 == 48014 
replace CA08_enep = 2.31137 if ces08_fed03 == 48015 
replace CA08_enep = 3.719953 if ces08_fed03 == 48016 
replace CA08_enep = 1.982957 if ces08_fed03 == 48017 
replace CA08_enep = 2.726824 if ces08_fed03 == 48018 
replace CA08_enep = 2.070477 if ces08_fed03 == 48019 
replace CA08_enep = 1.626489 if ces08_fed03 == 48020 
replace CA08_enep = 1.908576 if ces08_fed03 == 48021 
replace CA08_enep = 1.943355 if ces08_fed03 == 48022 
replace CA08_enep = 1.781077 if ces08_fed03 == 48023 
replace CA08_enep = 1.632068 if ces08_fed03 == 48024 
replace CA08_enep = 1.811967 if ces08_fed03 == 48025 
replace CA08_enep = 1.633615 if ces08_fed03 == 48026 
replace CA08_enep = 1.792773 if ces08_fed03 == 48027 
replace CA08_enep = 1.846011 if ces08_fed03 == 48028 
replace CA08_enep = 2.226495 if ces08_fed03 == 59001 
replace CA08_enep = 3.15848 if ces08_fed03 == 59002 
replace CA08_enep = 2.966031 if ces08_fed03 == 59003 
replace CA08_enep = 2.568341 if ces08_fed03 == 59004 
replace CA08_enep = 2.279351 if ces08_fed03 == 59005 
replace CA08_enep = 2.589149 if ces08_fed03 == 59006 
replace CA08_enep = 2.581009 if ces08_fed03 == 59007 
replace CA08_enep = 3.431564 if ces08_fed03 == 59008 
replace CA08_enep = 3.084884 if ces08_fed03 == 59009 
replace CA08_enep = 2.792176 if ces08_fed03 == 59010 
replace CA08_enep = 2.654964 if ces08_fed03 == 59011 
replace CA08_enep = 2.367424 if ces08_fed03 == 59012 
replace CA08_enep = 2.339523 if ces08_fed03 == 59013 
replace CA08_enep = 2.930019 if ces08_fed03 == 59014 
replace CA08_enep = 2.778182 if ces08_fed03 == 59015 
replace CA08_enep = 3.337458 if ces08_fed03 == 59016 
replace CA08_enep = 2.908565 if ces08_fed03 == 59017 
replace CA08_enep = 2.88751 if ces08_fed03 == 59018 
replace CA08_enep = 2.954247 if ces08_fed03 == 59019 
replace CA08_enep = 2.515524 if ces08_fed03 == 59020 
replace CA08_enep = 2.662345 if ces08_fed03 == 59021 
replace CA08_enep = 2.206609 if ces08_fed03 == 59022 
replace CA08_enep = 2.767881 if ces08_fed03 == 59023 
replace CA08_enep = 2.79656 if ces08_fed03 == 59024 
replace CA08_enep = 2.584369 if ces08_fed03 == 59025 
replace CA08_enep = 2.716278 if ces08_fed03 == 59026 
replace CA08_enep = 2.567181 if ces08_fed03 == 59027 
replace CA08_enep = 3.204983 if ces08_fed03 == 59028 
replace CA08_enep = 3.829837 if ces08_fed03 == 59029 
replace CA08_enep = 2.755756 if ces08_fed03 == 59030 
replace CA08_enep = 2.570481 if ces08_fed03 == 59031 
replace CA08_enep = 3.472573 if ces08_fed03 == 59032 
replace CA08_enep = 2.789409 if ces08_fed03 == 59033 
replace CA08_enep = 3.0357 if ces08_fed03 == 59034 
replace CA08_enep = 3.178637 if ces08_fed03 == 59035 
replace CA08_enep = 3.216572 if ces08_fed03 == 59036 
replace CA08_enep = 2.93719 if ces08_fed03 == 60001 
replace CA08_enep = 2.983141 if ces08_fed03 == 61001 
replace CA08_enep = 3.446605 if ces08_fed03 == 62001 


******************************************************
** INCUMBENT PARTY REELECTED: 2008 FEDERAL ELECTION **
******************************************************

gen CA08_reelected = .

replace CA08_reelected = 0 if ces08_fed03 == 10001 
replace CA08_reelected = 1 if ces08_fed03 == 10002 
replace CA08_reelected = 1 if ces08_fed03 == 10003 
replace CA08_reelected = 1 if ces08_fed03 == 10004 
replace CA08_reelected = 1 if ces08_fed03 == 10005 
replace CA08_reelected = 0 if ces08_fed03 == 10006 
replace CA08_reelected = 0 if ces08_fed03 == 10007 
replace CA08_reelected = 1 if ces08_fed03 == 11001 
replace CA08_reelected = 1 if ces08_fed03 == 11002 
replace CA08_reelected = 0 if ces08_fed03 == 11003 
replace CA08_reelected = 1 if ces08_fed03 == 11004 
replace CA08_reelected = 1 if ces08_fed03 == 12001 
replace CA08_reelected = 1 if ces08_fed03 == 12002 
replace CA08_reelected = 1 if ces08_fed03 == 12003 
replace CA08_reelected = 1 if ces08_fed03 == 12004 
replace CA08_reelected = 1 if ces08_fed03 == 12005 
replace CA08_reelected = 1 if ces08_fed03 == 12006 
replace CA08_reelected = 0 if ces08_fed03 == 12007 
replace CA08_reelected = 1 if ces08_fed03 == 12008 
replace CA08_reelected = 1 if ces08_fed03 == 12009 
replace CA08_reelected = 1 if ces08_fed03 == 12010 
replace CA08_reelected = 0 if ces08_fed03 == 12011 
replace CA08_reelected = 1 if ces08_fed03 == 13001 
replace CA08_reelected = 1 if ces08_fed03 == 13002 
replace CA08_reelected = 0 if ces08_fed03 == 13003 
replace CA08_reelected = 1 if ces08_fed03 == 13004 
replace CA08_reelected = 1 if ces08_fed03 == 13005 
replace CA08_reelected = 0 if ces08_fed03 == 13006 
replace CA08_reelected = 1 if ces08_fed03 == 13007 
replace CA08_reelected = 1 if ces08_fed03 == 13008 
replace CA08_reelected = 0 if ces08_fed03 == 13009 
replace CA08_reelected = 0 if ces08_fed03 == 13010 
replace CA08_reelected = 1 if ces08_fed03 == 24001 
replace CA08_reelected = 1 if ces08_fed03 == 24002 
replace CA08_reelected = 1 if ces08_fed03 == 24003 
replace CA08_reelected = 1 if ces08_fed03 == 24004 
replace CA08_reelected = 1 if ces08_fed03 == 24005 
replace CA08_reelected = 1 if ces08_fed03 == 24006 
replace CA08_reelected = 1 if ces08_fed03 == 24007 
replace CA08_reelected = 1 if ces08_fed03 == 24008 
replace CA08_reelected = 1 if ces08_fed03 == 24009 
replace CA08_reelected = 1 if ces08_fed03 == 24010 
replace CA08_reelected = 0 if ces08_fed03 == 24011 
replace CA08_reelected = 1 if ces08_fed03 == 24012 
replace CA08_reelected = 1 if ces08_fed03 == 24013 
replace CA08_reelected = 1 if ces08_fed03 == 24014 
replace CA08_reelected = 1 if ces08_fed03 == 24015 
replace CA08_reelected = 1 if ces08_fed03 == 24016 
replace CA08_reelected = 0 if ces08_fed03 == 24017 
replace CA08_reelected = 1 if ces08_fed03 == 24018 
replace CA08_reelected = 1 if ces08_fed03 == 24019 
replace CA08_reelected = 1 if ces08_fed03 == 24020 
replace CA08_reelected = 1 if ces08_fed03 == 24021 
replace CA08_reelected = 1 if ces08_fed03 == 24022 
replace CA08_reelected = 1 if ces08_fed03 == 24023 
replace CA08_reelected = 1 if ces08_fed03 == 24024 
replace CA08_reelected = 1 if ces08_fed03 == 24025 
replace CA08_reelected = 1 if ces08_fed03 == 24026 
replace CA08_reelected = 1 if ces08_fed03 == 24027 
replace CA08_reelected = 1 if ces08_fed03 == 24028 
replace CA08_reelected = 1 if ces08_fed03 == 24029 
replace CA08_reelected = 1 if ces08_fed03 == 24030 
replace CA08_reelected = 1 if ces08_fed03 == 24031 
replace CA08_reelected = 1 if ces08_fed03 == 24032 
replace CA08_reelected = 1 if ces08_fed03 == 24033 
replace CA08_reelected = 1 if ces08_fed03 == 24034 
replace CA08_reelected = 1 if ces08_fed03 == 24035 
replace CA08_reelected = 1 if ces08_fed03 == 24036 
replace CA08_reelected = 0 if ces08_fed03 == 24037 
replace CA08_reelected = 1 if ces08_fed03 == 24038 
replace CA08_reelected = 1 if ces08_fed03 == 24039 
replace CA08_reelected = 1 if ces08_fed03 == 24040 
replace CA08_reelected = 1 if ces08_fed03 == 24041 
replace CA08_reelected = 1 if ces08_fed03 == 24042 
replace CA08_reelected = 1 if ces08_fed03 == 24043 
replace CA08_reelected = 1 if ces08_fed03 == 24044 
replace CA08_reelected = 1 if ces08_fed03 == 24045 
replace CA08_reelected = 1 if ces08_fed03 == 24046 
replace CA08_reelected = 0 if ces08_fed03 == 24047 
replace CA08_reelected = 0 if ces08_fed03 == 24048 
replace CA08_reelected = 1 if ces08_fed03 == 24049 
replace CA08_reelected = 1 if ces08_fed03 == 24050 
replace CA08_reelected = 1 if ces08_fed03 == 24051 
replace CA08_reelected = 1 if ces08_fed03 == 24052 
replace CA08_reelected = 1 if ces08_fed03 == 24053 
replace CA08_reelected = 1 if ces08_fed03 == 24054 
replace CA08_reelected = 1 if ces08_fed03 == 24055 
replace CA08_reelected = 1 if ces08_fed03 == 24056 
replace CA08_reelected = 1 if ces08_fed03 == 24057 
replace CA08_reelected = 1 if ces08_fed03 == 24058 
replace CA08_reelected = 1 if ces08_fed03 == 24059 
replace CA08_reelected = 0 if ces08_fed03 == 24060 
replace CA08_reelected = 1 if ces08_fed03 == 24061 
replace CA08_reelected = 1 if ces08_fed03 == 24062 
replace CA08_reelected = 1 if ces08_fed03 == 24063 
replace CA08_reelected = 1 if ces08_fed03 == 24064 
replace CA08_reelected = 1 if ces08_fed03 == 24065 
replace CA08_reelected = 1 if ces08_fed03 == 24066 
replace CA08_reelected = 1 if ces08_fed03 == 24067 
replace CA08_reelected = 1 if ces08_fed03 == 24068 
replace CA08_reelected = 1 if ces08_fed03 == 24069 
replace CA08_reelected = 1 if ces08_fed03 == 24070 
replace CA08_reelected = 1 if ces08_fed03 == 24071 
replace CA08_reelected = 1 if ces08_fed03 == 24072 
replace CA08_reelected = 1 if ces08_fed03 == 24073 
replace CA08_reelected = 1 if ces08_fed03 == 24074 
replace CA08_reelected = 1 if ces08_fed03 == 24075 
replace CA08_reelected = 1 if ces08_fed03 == 35001 
replace CA08_reelected = 0 if ces08_fed03 == 35002 
replace CA08_reelected = 1 if ces08_fed03 == 35003 
replace CA08_reelected = 1 if ces08_fed03 == 35004 
replace CA08_reelected = 1 if ces08_fed03 == 35005 
replace CA08_reelected = 1 if ces08_fed03 == 35006 
replace CA08_reelected = 1 if ces08_fed03 == 35007 
replace CA08_reelected = 1 if ces08_fed03 == 35008 
replace CA08_reelected = 0 if ces08_fed03 == 35009 
replace CA08_reelected = 1 if ces08_fed03 == 35010 
replace CA08_reelected = 1 if ces08_fed03 == 35011 
replace CA08_reelected = 1 if ces08_fed03 == 35012 
replace CA08_reelected = 1 if ces08_fed03 == 35013 
replace CA08_reelected = 1 if ces08_fed03 == 35014 
replace CA08_reelected = 1 if ces08_fed03 == 35015 
replace CA08_reelected = 1 if ces08_fed03 == 35016 
replace CA08_reelected = 1 if ces08_fed03 == 35017 
replace CA08_reelected = 1 if ces08_fed03 == 35018 
replace CA08_reelected = 1 if ces08_fed03 == 35019 
replace CA08_reelected = 1 if ces08_fed03 == 35020 
replace CA08_reelected = 1 if ces08_fed03 == 35021 
replace CA08_reelected = 1 if ces08_fed03 == 35022 
replace CA08_reelected = 1 if ces08_fed03 == 35023 
replace CA08_reelected = 1 if ces08_fed03 == 35024 
replace CA08_reelected = 1 if ces08_fed03 == 35025 
replace CA08_reelected = 1 if ces08_fed03 == 35026 
replace CA08_reelected = 1 if ces08_fed03 == 35027 
replace CA08_reelected = 1 if ces08_fed03 == 35028 
replace CA08_reelected = 1 if ces08_fed03 == 35029 
replace CA08_reelected = 1 if ces08_fed03 == 35030 
replace CA08_reelected = 1 if ces08_fed03 == 35031 
replace CA08_reelected = 1 if ces08_fed03 == 35032 
replace CA08_reelected = 1 if ces08_fed03 == 35033 
replace CA08_reelected = 0 if ces08_fed03 == 35034 
replace CA08_reelected = 0 if ces08_fed03 == 35035 
replace CA08_reelected = 1 if ces08_fed03 == 35036 
replace CA08_reelected = 0 if ces08_fed03 == 35037 
replace CA08_reelected = 1 if ces08_fed03 == 35038 
replace CA08_reelected = 0 if ces08_fed03 == 35039 
replace CA08_reelected = 1 if ces08_fed03 == 35040 
replace CA08_reelected = 1 if ces08_fed03 == 35041 
replace CA08_reelected = 1 if ces08_fed03 == 35042 
replace CA08_reelected = 1 if ces08_fed03 == 35043 
replace CA08_reelected = 0 if ces08_fed03 == 35044 
replace CA08_reelected = 1 if ces08_fed03 == 35045 
replace CA08_reelected = 1 if ces08_fed03 == 35046 
replace CA08_reelected = 1 if ces08_fed03 == 35047 
replace CA08_reelected = 1 if ces08_fed03 == 35048 
replace CA08_reelected = 0 if ces08_fed03 == 35049 
replace CA08_reelected = 1 if ces08_fed03 == 35050 
replace CA08_reelected = 1 if ces08_fed03 == 35051 
replace CA08_reelected = 1 if ces08_fed03 == 35052 
replace CA08_reelected = 0 if ces08_fed03 == 35053 
replace CA08_reelected = 1 if ces08_fed03 == 35054 
replace CA08_reelected = 1 if ces08_fed03 == 35055 
replace CA08_reelected = 0 if ces08_fed03 == 35056 
replace CA08_reelected = 1 if ces08_fed03 == 35057 
replace CA08_reelected = 1 if ces08_fed03 == 35058 
replace CA08_reelected = 0 if ces08_fed03 == 35059 
replace CA08_reelected = 0 if ces08_fed03 == 35060 
replace CA08_reelected = 1 if ces08_fed03 == 35061 
replace CA08_reelected = 1 if ces08_fed03 == 35062 
replace CA08_reelected = 1 if ces08_fed03 == 35063 
replace CA08_reelected = 1 if ces08_fed03 == 35064 
replace CA08_reelected = 1 if ces08_fed03 == 35065 
replace CA08_reelected = 1 if ces08_fed03 == 35066 
replace CA08_reelected = 1 if ces08_fed03 == 35067 
replace CA08_reelected = 0 if ces08_fed03 == 35068 
replace CA08_reelected = 1 if ces08_fed03 == 35069 
replace CA08_reelected = 1 if ces08_fed03 == 35070 
replace CA08_reelected = 1 if ces08_fed03 == 35071 
replace CA08_reelected = 1 if ces08_fed03 == 35072 
replace CA08_reelected = 1 if ces08_fed03 == 35073 
replace CA08_reelected = 1 if ces08_fed03 == 35074 
replace CA08_reelected = 1 if ces08_fed03 == 35075 
replace CA08_reelected = 1 if ces08_fed03 == 35076 
replace CA08_reelected = 1 if ces08_fed03 == 35077 
replace CA08_reelected = 1 if ces08_fed03 == 35078 
replace CA08_reelected = 1 if ces08_fed03 == 35079 
replace CA08_reelected = 1 if ces08_fed03 == 35080 
replace CA08_reelected = 1 if ces08_fed03 == 35081 
replace CA08_reelected = 1 if ces08_fed03 == 35082 
replace CA08_reelected = 1 if ces08_fed03 == 35083 
replace CA08_reelected = 1 if ces08_fed03 == 35084 
replace CA08_reelected = 1 if ces08_fed03 == 35085 
replace CA08_reelected = 1 if ces08_fed03 == 35086 
replace CA08_reelected = 1 if ces08_fed03 == 35087 
replace CA08_reelected = 0 if ces08_fed03 == 35088 
replace CA08_reelected = 0 if ces08_fed03 == 35089 
replace CA08_reelected = 0 if ces08_fed03 == 35090 
replace CA08_reelected = 0 if ces08_fed03 == 35091 
replace CA08_reelected = 1 if ces08_fed03 == 35092 
replace CA08_reelected = 1 if ces08_fed03 == 35093 
replace CA08_reelected = 1 if ces08_fed03 == 35094 
replace CA08_reelected = 1 if ces08_fed03 == 35095 
replace CA08_reelected = 1 if ces08_fed03 == 35096 
replace CA08_reelected = 0 if ces08_fed03 == 35097 
replace CA08_reelected = 1 if ces08_fed03 == 35098 
replace CA08_reelected = 1 if ces08_fed03 == 35099 
replace CA08_reelected = 1 if ces08_fed03 == 35100 
replace CA08_reelected = 1 if ces08_fed03 == 35101 
replace CA08_reelected = 1 if ces08_fed03 == 35102 
replace CA08_reelected = 1 if ces08_fed03 == 35103 
replace CA08_reelected = 1 if ces08_fed03 == 35104 
replace CA08_reelected = 1 if ces08_fed03 == 35105 
replace CA08_reelected = 1 if ces08_fed03 == 35106 
replace CA08_reelected = 1 if ces08_fed03 == 46001 
replace CA08_reelected = 1 if ces08_fed03 == 46002 
replace CA08_reelected = 0 if ces08_fed03 == 46003 
replace CA08_reelected = 1 if ces08_fed03 == 46004 
replace CA08_reelected = 1 if ces08_fed03 == 46005 
replace CA08_reelected = 1 if ces08_fed03 == 46006 
replace CA08_reelected = 1 if ces08_fed03 == 46007 
replace CA08_reelected = 1 if ces08_fed03 == 46008 
replace CA08_reelected = 0 if ces08_fed03 == 46009 
replace CA08_reelected = 1 if ces08_fed03 == 46010 
replace CA08_reelected = 1 if ces08_fed03 == 46011 
replace CA08_reelected = 1 if ces08_fed03 == 46012 
replace CA08_reelected = 1 if ces08_fed03 == 46013 
replace CA08_reelected = 1 if ces08_fed03 == 46014 
replace CA08_reelected = 1 if ces08_fed03 == 47001 
replace CA08_reelected = 1 if ces08_fed03 == 47002 
replace CA08_reelected = 0 if ces08_fed03 == 47003 
replace CA08_reelected = 1 if ces08_fed03 == 47004 
replace CA08_reelected = 1 if ces08_fed03 == 47005 
replace CA08_reelected = 1 if ces08_fed03 == 47006 
replace CA08_reelected = 1 if ces08_fed03 == 47007 
replace CA08_reelected = 1 if ces08_fed03 == 47008 
replace CA08_reelected = 1 if ces08_fed03 == 47009 
replace CA08_reelected = 1 if ces08_fed03 == 47010 
replace CA08_reelected = 1 if ces08_fed03 == 47011 
replace CA08_reelected = 1 if ces08_fed03 == 47012 
replace CA08_reelected = 1 if ces08_fed03 == 47013 
replace CA08_reelected = 1 if ces08_fed03 == 47014 
replace CA08_reelected = 1 if ces08_fed03 == 48001 
replace CA08_reelected = 1 if ces08_fed03 == 48002 
replace CA08_reelected = 1 if ces08_fed03 == 48003 
replace CA08_reelected = 1 if ces08_fed03 == 48004 
replace CA08_reelected = 1 if ces08_fed03 == 48005 
replace CA08_reelected = 1 if ces08_fed03 == 48006 
replace CA08_reelected = 1 if ces08_fed03 == 48007 
replace CA08_reelected = 1 if ces08_fed03 == 48008 
replace CA08_reelected = 1 if ces08_fed03 == 48009 
replace CA08_reelected = 1 if ces08_fed03 == 48010 
replace CA08_reelected = 1 if ces08_fed03 == 48011 
replace CA08_reelected = 1 if ces08_fed03 == 48012 
replace CA08_reelected = 1 if ces08_fed03 == 48013 
replace CA08_reelected = 1 if ces08_fed03 == 48014 
replace CA08_reelected = 1 if ces08_fed03 == 48015 
replace CA08_reelected = 1 if ces08_fed03 == 48016 
replace CA08_reelected = 1 if ces08_fed03 == 48017 
replace CA08_reelected = 0 if ces08_fed03 == 48018 
replace CA08_reelected = 1 if ces08_fed03 == 48019 
replace CA08_reelected = 1 if ces08_fed03 == 48020 
replace CA08_reelected = 1 if ces08_fed03 == 48021 
replace CA08_reelected = 1 if ces08_fed03 == 48022 
replace CA08_reelected = 1 if ces08_fed03 == 48023 
replace CA08_reelected = 1 if ces08_fed03 == 48024 
replace CA08_reelected = 1 if ces08_fed03 == 48025 
replace CA08_reelected = 1 if ces08_fed03 == 48026 
replace CA08_reelected = 1 if ces08_fed03 == 48027 
replace CA08_reelected = 1 if ces08_fed03 == 48028 
replace CA08_reelected = 1 if ces08_fed03 == 59001 
replace CA08_reelected = 1 if ces08_fed03 == 59002 
replace CA08_reelected = 1 if ces08_fed03 == 59003 
replace CA08_reelected = 1 if ces08_fed03 == 59004 
replace CA08_reelected = 1 if ces08_fed03 == 59005 
replace CA08_reelected = 1 if ces08_fed03 == 59006 
replace CA08_reelected = 1 if ces08_fed03 == 59007 
replace CA08_reelected = 1 if ces08_fed03 == 59008 
replace CA08_reelected = 1 if ces08_fed03 == 59009 
replace CA08_reelected = 1 if ces08_fed03 == 59010 
replace CA08_reelected = 0 if ces08_fed03 == 59011 
replace CA08_reelected = 1 if ces08_fed03 == 59012 
replace CA08_reelected = 1 if ces08_fed03 == 59013 
replace CA08_reelected = 1 if ces08_fed03 == 59014 
replace CA08_reelected = 1 if ces08_fed03 == 59015 
replace CA08_reelected = 1 if ces08_fed03 == 59016 
replace CA08_reelected = 1 if ces08_fed03 == 59017 
replace CA08_reelected = 1 if ces08_fed03 == 59018 
replace CA08_reelected = 0 if ces08_fed03 == 59019 
replace CA08_reelected = 1 if ces08_fed03 == 59020 
replace CA08_reelected = 1 if ces08_fed03 == 59021 
replace CA08_reelected = 1 if ces08_fed03 == 59022 
replace CA08_reelected = 0 if ces08_fed03 == 59023 
replace CA08_reelected = 1 if ces08_fed03 == 59024 
replace CA08_reelected = 1 if ces08_fed03 == 59025 
replace CA08_reelected = 1 if ces08_fed03 == 59026 
replace CA08_reelected = 1 if ces08_fed03 == 59027 
replace CA08_reelected = 0 if ces08_fed03 == 59028 
replace CA08_reelected = 1 if ces08_fed03 == 59029 
replace CA08_reelected = 1 if ces08_fed03 == 59030 
replace CA08_reelected = 0 if ces08_fed03 == 59031 
replace CA08_reelected = 0 if ces08_fed03 == 59032 
replace CA08_reelected = 1 if ces08_fed03 == 59033 
replace CA08_reelected = 1 if ces08_fed03 == 59034 
replace CA08_reelected = 1 if ces08_fed03 == 59035 
replace CA08_reelected = 0 if ces08_fed03 == 59036 
replace CA08_reelected = 1 if ces08_fed03 == 60001 
replace CA08_reelected = 1 if ces08_fed03 == 61001 
replace CA08_reelected = 0 if ces08_fed03 == 62001  


**************************************************
** INDEPENDENT VARIABLES: 2008 FEDERAL ELECTION **
**************************************************

* Party identification (national)

gen CA08_pidstatus_whole = .

replace CA08_pidstatus_whole = 9999 if ces08_cps_q1a == 99 & ces08_cps_q4 == .
replace CA08_pidstatus_whole = 9999 if ces08_cps_q1a == . & ces08_cps_q4 == .
replace CA08_pidstatus_whole = 9999 if ces08_cps_q3 == 1 & ces08_cps_q4 == 98 | ces08_cps_q3 == 1 & ces08_cps_q4 == 99
replace CA08_pidstatus_whole = 9999 if ces08_cps_q1a == 98 & ces08_cps_q3 == 8 | ces08_cps_q1a == 98 & ces08_cps_q3 == 9 | ces08_cps_q1a == 99 & ces08_cps_q3 == 8 | ces08_cps_q1a == 99 & ces08_cps_q3 == 9

replace CA08_pidstatus_whole = 2 if ces08_cps_q1a == 97 & ces08_cps_q3 == 5 | ces08_cps_q1a == 97 & ces08_cps_q3 == 8 | ces08_cps_q1a == 97 & ces08_cps_q3 == 9 | ces08_cps_q1a == 98 & ces08_cps_q3 == 5

replace CA08_pidstatus_whole = 3 if ces08_cps_q1a == 2 & CA08_pidstatus_whole!=2 & CA08_pidstatus_whole!=9999
replace CA08_pidstatus_whole = 3 if ces08_cps_q4 == 2 & CA08_pidstatus_whole!=2 & CA08_pidstatus_whole!=9999

replace CA08_pidstatus_whole = 1 if ces08_cps_q1a!=2 & ces08_cps_q1a!=. & CA08_pidstatus_whole!=2 & CA08_pidstatus_whole!=3 & CA08_pidstatus_whole!=9999
replace CA08_pidstatus_whole = 1 if ces08_cps_q4!=2 & ces08_cps_q4!=. & CA08_pidstatus_whole!=2 & CA08_pidstatus_whole!=3 & CA08_pidstatus_whole!=9999

gen CA08_winner_leaner_whole = 1 if ces08_cps_q3 == 1 & CA08_pidstatus_whole == 3
gen CA08_loser_leaner_whole = 1 if ces08_cps_q3 == 1 & CA08_pidstatus_whole == 1

replace CA08_pidstatus_whole = . if CA08_pidstatus_whole == 9999

label values CA08_pidstatus_whole pidstatus

* Party identification scale (national)

gen CA08_pidscale_whole = .

replace CA08_pidscale_whole = 1 if CA08_pidstatus_whole == 1 & ces08_cps_q2 == 1
replace CA08_pidscale_whole = 2 if CA08_pidstatus_whole == 1 & ces08_cps_q2 == 3
replace CA08_pidscale_whole = 3 if CA08_pidstatus_whole == 1 & ces08_cps_q2 == 5 | CA08_loser_leaner_whole == 1
replace CA08_pidscale_whole = 4 if CA08_pidstatus_whole == 2
replace CA08_pidscale_whole = 5 if CA08_pidstatus_whole == 3 & ces08_cps_q2 == 5 | CA08_winner_leaner_whole == 1
replace CA08_pidscale_whole = 6 if CA08_pidstatus_whole == 3 & ces08_cps_q2 == 3
replace CA08_pidscale_whole = 7 if CA08_pidstatus_whole == 3 & ces08_cps_q2 == 1

label values CA08_pidscale_whole pidscale

* Party identification (district)

gen CA08_pidstatus_district = .

replace CA08_pidstatus_district = 9999 if ces08_cps_q1a == 99 & ces08_cps_q4 == . // Replace by 9999 is missing data for party identification
replace CA08_pidstatus_district = 9999 if ces08_cps_q1a == . & ces08_cps_q4 == . // Replace by 9999 is missing data for party identification
replace CA08_pidstatus_district = 9999 if ces08_cps_q3 == 1 & ces08_cps_q4 == 98 | ces08_cps_q3 == 1 & ces08_cps_q4 == 99 // Replace by 9999 if respondent feels a little closer to one party but don't know which or refused to say which
replace CA08_pidstatus_district = 9999 if ces08_cps_q1a == 98 & ces08_cps_q3 == 8 | ces08_cps_q1a == 98 & ces08_cps_q3 == 9 | ces08_cps_q1a == 99 & ces08_cps_q3 == 8 | ces08_cps_q1a == 99 & ces08_cps_q3 == 9 // Replace by 9999 if respondent don't know if he/she identifies with a party or refused to say and don't know if he/she feels a little closer to one party or refused to say

replace CA08_pidstatus_district = 2 if ces08_cps_q1a == 97 & ces08_cps_q3 == 5 | ces08_cps_q1a == 97 & ces08_cps_q3 == 8 | ces08_cps_q1a == 97 & ces08_cps_q3 == 9 | ces08_cps_q1a == 98 & ces08_cps_q3 == 5 // No PID

replace CA08_pidstatus_district = 3 if ces08_cps_q1a == CA08_district_outcome & CA08_pidstatus_district!=2 & CA08_pidstatus_district!=9999 // Loser PID
replace CA08_pidstatus_district = 3 if ces08_cps_q4 == CA08_district_outcome & CA08_pidstatus_district!=2 & CA08_pidstatus_district!=9999 // Loser PID

replace CA08_pidstatus_district = 1 if ces08_cps_q1a!=CA08_district_outcome & ces08_cps_q1a!=. & CA08_pidstatus_district!=2 & CA08_pidstatus_district!=3 & CA08_pidstatus_district!=9999 // Winner PID
replace CA08_pidstatus_district = 1 if ces08_cps_q4!=CA08_district_outcome & ces08_cps_q4!=. & CA08_pidstatus_district!=2 & CA08_pidstatus_district!=3 & CA08_pidstatus_district!=9999 // Winner PID

gen CA08_winner_leaner_district = 1 if ces08_cps_q3 == 1 & CA08_pidstatus_district == 3 // Winner leaner
gen CA08_loser_leaner_district = 1 if ces08_cps_q3 == 1 & CA08_pidstatus_district == 1 // Loser leaner

replace CA08_pidstatus_district = . if CA08_pidstatus_district == 9999 // Missing data
 
label values CA08_pidstatus_district pidstatus

* Party identification scale (district)

gen CA08_pidscale_district = .

replace CA08_pidscale_district = 1 if CA08_pidstatus_district == 1 & ces08_cps_q2 == 1 // Strong (very strongly) loser PID
replace CA08_pidscale_district = 2 if CA08_pidstatus_district == 1 & ces08_cps_q2 == 3 // Moderate (fairly strongly) loser PID
replace CA08_pidscale_district = 3 if CA08_pidstatus_district == 1 & ces08_cps_q2 == 5 | CA08_winner_leaner_district == 1 // Weak (not very strongly) loser PID
replace CA08_pidscale_district = 4 if CA08_pidstatus_district == 2 // No PID
replace CA08_pidscale_district = 5 if CA08_pidstatus_district == 3 & ces08_cps_q2 == 5 | CA08_loser_leaner_district == 1 // Weak (not very strongly) winner PID
replace CA08_pidscale_district = 6 if CA08_pidstatus_district == 3 & ces08_cps_q2 == 3 // Moderate (fairly strongly) winner PID
replace CA08_pidscale_district = 7 if CA08_pidstatus_district == 3 & ces08_cps_q2 == 1 // Strong (very strongly) winner PID

label values CA08_pidscale_district pidscale

* Interest for election

gen CA08_interest = ces08_cps_a3 // Interest for election

recode CA08_interest (98=.) // Recode "don't know" as missing data
recode CA08_interest (99=.) // Recode "refused" as missing data

* Election news attentiveness

gen CA08_tv = ces08_pes_a4 // Attention paid to election on TV

recode CA08_tv (98=.) // Recode "don't know" as missing data
recode CA08_tv (99=.) // Recode "refused" as missing data

gen CA08_radio = ces08_pes_a5 // Attention paid to election on radio

recode CA08_radio (98=.) // Recode "don't know" as missing data
recode CA08_radio (99=.) // Recode "refused" as missing data

gen CA08_newspapers = ces08_pes_a6 // Attention paid to election in newspapers

recode CA08_newspapers (98=.) // Recode "don't know" as missing data
recode CA08_newspapers (99=.) // Recode "refused" as missing data

gen CA08_internet = ces08_pes_a7 // Attention paid to election on internet

recode CA08_internet (98=.) // Recode "don't know" as missing data
recode CA08_internet (99=.) // Recode "refused" as missing data

egen CA08_news = rowmax(CA08_tv CA08_radio CA08_newspapers CA08_internet) // Election news attentiveness

* Education

gen CA08_education = ces08_cps_s3 // Highest level of education completed by respondent

recode CA08_education (98=.) // Recode "don't know" as missing data
recode CA08_education (99=.) // Recode "refused" as missing data

* Response date

gen ces08_cps_intday = .

replace ces08_cps_intday = 28 if ces08_idnum == 1
replace ces08_cps_intday = 12 if ces08_idnum == 2
replace ces08_cps_intday = 7 if ces08_idnum == 3
replace ces08_cps_intday = 30 if ces08_idnum == 4
replace ces08_cps_intday = 2 if ces08_idnum == 5
replace ces08_cps_intday = 10 if ces08_idnum == 10
replace ces08_cps_intday = 30 if ces08_idnum == 13
replace ces08_cps_intday = 8 if ces08_idnum == 22
replace ces08_cps_intday = 9 if ces08_idnum == 24
replace ces08_cps_intday = 28 if ces08_idnum == 40
replace ces08_cps_intday = 29 if ces08_idnum == 41
replace ces08_cps_intday = 27 if ces08_idnum == 43
replace ces08_cps_intday = 28 if ces08_idnum == 44
replace ces08_cps_intday = 26 if ces08_idnum == 45
replace ces08_cps_intday = 26 if ces08_idnum == 50
replace ces08_cps_intday = 10 if ces08_idnum == 52
replace ces08_cps_intday = 8 if ces08_idnum == 54
replace ces08_cps_intday = 30 if ces08_idnum == 55
replace ces08_cps_intday = 30 if ces08_idnum == 58
replace ces08_cps_intday = 27 if ces08_idnum == 66
replace ces08_cps_intday = 9 if ces08_idnum == 67
replace ces08_cps_intday = 29 if ces08_idnum == 69
replace ces08_cps_intday = 27 if ces08_idnum == 70
replace ces08_cps_intday = 2 if ces08_idnum == 74
replace ces08_cps_intday = 5 if ces08_idnum == 77
replace ces08_cps_intday = 9 if ces08_idnum == 80
replace ces08_cps_intday = 27 if ces08_idnum == 84
replace ces08_cps_intday = 30 if ces08_idnum == 85
replace ces08_cps_intday = 1 if ces08_idnum == 86
replace ces08_cps_intday = 8 if ces08_idnum == 90
replace ces08_cps_intday = 27 if ces08_idnum == 91
replace ces08_cps_intday = 6 if ces08_idnum == 92
replace ces08_cps_intday = 28 if ces08_idnum == 93
replace ces08_cps_intday = 2 if ces08_idnum == 95
replace ces08_cps_intday = 28 if ces08_idnum == 97
replace ces08_cps_intday = 13 if ces08_idnum == 98
replace ces08_cps_intday = 29 if ces08_idnum == 102
replace ces08_cps_intday = 27 if ces08_idnum == 104
replace ces08_cps_intday = 7 if ces08_idnum == 108
replace ces08_cps_intday = 27 if ces08_idnum == 114
replace ces08_cps_intday = 27 if ces08_idnum == 115
replace ces08_cps_intday = 13 if ces08_idnum == 117
replace ces08_cps_intday = 27 if ces08_idnum == 119
replace ces08_cps_intday = 11 if ces08_idnum == 123
replace ces08_cps_intday = 1 if ces08_idnum == 127
replace ces08_cps_intday = 29 if ces08_idnum == 129
replace ces08_cps_intday = 1 if ces08_idnum == 131
replace ces08_cps_intday = 6 if ces08_idnum == 134
replace ces08_cps_intday = 29 if ces08_idnum == 135
replace ces08_cps_intday = 7 if ces08_idnum == 144
replace ces08_cps_intday = 2 if ces08_idnum == 149
replace ces08_cps_intday = 4 if ces08_idnum == 150
replace ces08_cps_intday = 29 if ces08_idnum == 152
replace ces08_cps_intday = 8 if ces08_idnum == 159
replace ces08_cps_intday = 29 if ces08_idnum == 164
replace ces08_cps_intday = 4 if ces08_idnum == 167
replace ces08_cps_intday = 6 if ces08_idnum == 169
replace ces08_cps_intday = 10 if ces08_idnum == 175
replace ces08_cps_intday = 8 if ces08_idnum == 178
replace ces08_cps_intday = 2 if ces08_idnum == 179
replace ces08_cps_intday = 6 if ces08_idnum == 180
replace ces08_cps_intday = 4 if ces08_idnum == 182
replace ces08_cps_intday = 10 if ces08_idnum == 187
replace ces08_cps_intday = 1 if ces08_idnum == 189
replace ces08_cps_intday = 29 if ces08_idnum == 190
replace ces08_cps_intday = 30 if ces08_idnum == 192
replace ces08_cps_intday = 4 if ces08_idnum == 195
replace ces08_cps_intday = 4 if ces08_idnum == 197
replace ces08_cps_intday = 5 if ces08_idnum == 200
replace ces08_cps_intday = 4 if ces08_idnum == 203
replace ces08_cps_intday = 29 if ces08_idnum == 204
replace ces08_cps_intday = 29 if ces08_idnum == 209
replace ces08_cps_intday = 30 if ces08_idnum == 213
replace ces08_cps_intday = 2 if ces08_idnum == 214
replace ces08_cps_intday = 3 if ces08_idnum == 216
replace ces08_cps_intday = 3 if ces08_idnum == 220
replace ces08_cps_intday = 1 if ces08_idnum == 222
replace ces08_cps_intday = 29 if ces08_idnum == 226
replace ces08_cps_intday = 30 if ces08_idnum == 227
replace ces08_cps_intday = 8 if ces08_idnum == 228
replace ces08_cps_intday = 1 if ces08_idnum == 233
replace ces08_cps_intday = 29 if ces08_idnum == 236
replace ces08_cps_intday = 6 if ces08_idnum == 245
replace ces08_cps_intday = 4 if ces08_idnum == 254
replace ces08_cps_intday = 12 if ces08_idnum == 256
replace ces08_cps_intday = 12 if ces08_idnum == 259
replace ces08_cps_intday = 10 if ces08_idnum == 260
replace ces08_cps_intday = 9 if ces08_idnum == 263
replace ces08_cps_intday = 6 if ces08_idnum == 264
replace ces08_cps_intday = 13 if ces08_idnum == 268
replace ces08_cps_intday = 11 if ces08_idnum == 269
replace ces08_cps_intday = 3 if ces08_idnum == 271
replace ces08_cps_intday = 4 if ces08_idnum == 273
replace ces08_cps_intday = 5 if ces08_idnum == 274
replace ces08_cps_intday = 4 if ces08_idnum == 279
replace ces08_cps_intday = 3 if ces08_idnum == 280
replace ces08_cps_intday = 6 if ces08_idnum == 282
replace ces08_cps_intday = 4 if ces08_idnum == 287
replace ces08_cps_intday = 3 if ces08_idnum == 291
replace ces08_cps_intday = 7 if ces08_idnum == 295
replace ces08_cps_intday = 3 if ces08_idnum == 299
replace ces08_cps_intday = 12 if ces08_idnum == 300
replace ces08_cps_intday = 30 if ces08_idnum == 501
replace ces08_cps_intday = 5 if ces08_idnum == 505
replace ces08_cps_intday = 30 if ces08_idnum == 508
replace ces08_cps_intday = 26 if ces08_idnum == 512
replace ces08_cps_intday = 2 if ces08_idnum == 514
replace ces08_cps_intday = 11 if ces08_idnum == 518
replace ces08_cps_intday = 10 if ces08_idnum == 524
replace ces08_cps_intday = 4 if ces08_idnum == 527
replace ces08_cps_intday = 29 if ces08_idnum == 528
replace ces08_cps_intday = 9 if ces08_idnum == 531
replace ces08_cps_intday = 27 if ces08_idnum == 533
replace ces08_cps_intday = 28 if ces08_idnum == 534
replace ces08_cps_intday = 30 if ces08_idnum == 538
replace ces08_cps_intday = 29 if ces08_idnum == 539
replace ces08_cps_intday = 1 if ces08_idnum == 545
replace ces08_cps_intday = 2 if ces08_idnum == 548
replace ces08_cps_intday = 8 if ces08_idnum == 549
replace ces08_cps_intday = 27 if ces08_idnum == 552
replace ces08_cps_intday = 2 if ces08_idnum == 555
replace ces08_cps_intday = 4 if ces08_idnum == 556
replace ces08_cps_intday = 28 if ces08_idnum == 558
replace ces08_cps_intday = 3 if ces08_idnum == 565
replace ces08_cps_intday = 27 if ces08_idnum == 570
replace ces08_cps_intday = 6 if ces08_idnum == 571
replace ces08_cps_intday = 2 if ces08_idnum == 576
replace ces08_cps_intday = 27 if ces08_idnum == 582
replace ces08_cps_intday = 30 if ces08_idnum == 585
replace ces08_cps_intday = 27 if ces08_idnum == 586
replace ces08_cps_intday = 10 if ces08_idnum == 589
replace ces08_cps_intday = 11 if ces08_idnum == 590
replace ces08_cps_intday = 7 if ces08_idnum == 591
replace ces08_cps_intday = 9 if ces08_idnum == 594
replace ces08_cps_intday = 4 if ces08_idnum == 597
replace ces08_cps_intday = 27 if ces08_idnum == 600
replace ces08_cps_intday = 2 if ces08_idnum == 601
replace ces08_cps_intday = 9 if ces08_idnum == 602
replace ces08_cps_intday = 6 if ces08_idnum == 603
replace ces08_cps_intday = 27 if ces08_idnum == 605
replace ces08_cps_intday = 27 if ces08_idnum == 606
replace ces08_cps_intday = 13 if ces08_idnum == 611
replace ces08_cps_intday = 4 if ces08_idnum == 614
replace ces08_cps_intday = 6 if ces08_idnum == 617
replace ces08_cps_intday = 2 if ces08_idnum == 618
replace ces08_cps_intday = 6 if ces08_idnum == 621
replace ces08_cps_intday = 27 if ces08_idnum == 624
replace ces08_cps_intday = 6 if ces08_idnum == 625
replace ces08_cps_intday = 27 if ces08_idnum == 627
replace ces08_cps_intday = 8 if ces08_idnum == 630
replace ces08_cps_intday = 8 if ces08_idnum == 634
replace ces08_cps_intday = 28 if ces08_idnum == 642
replace ces08_cps_intday = 3 if ces08_idnum == 643
replace ces08_cps_intday = 4 if ces08_idnum == 649
replace ces08_cps_intday = 29 if ces08_idnum == 654
replace ces08_cps_intday = 3 if ces08_idnum == 656
replace ces08_cps_intday = 29 if ces08_idnum == 657
replace ces08_cps_intday = 30 if ces08_idnum == 658
replace ces08_cps_intday = 2 if ces08_idnum == 664
replace ces08_cps_intday = 29 if ces08_idnum == 665
replace ces08_cps_intday = 29 if ces08_idnum == 667
replace ces08_cps_intday = 12 if ces08_idnum == 668
replace ces08_cps_intday = 29 if ces08_idnum == 669
replace ces08_cps_intday = 3 if ces08_idnum == 672
replace ces08_cps_intday = 29 if ces08_idnum == 673
replace ces08_cps_intday = 30 if ces08_idnum == 674
replace ces08_cps_intday = 29 if ces08_idnum == 676
replace ces08_cps_intday = 1 if ces08_idnum == 685
replace ces08_cps_intday = 1 if ces08_idnum == 688
replace ces08_cps_intday = 1 if ces08_idnum == 689
replace ces08_cps_intday = 29 if ces08_idnum == 690
replace ces08_cps_intday = 30 if ces08_idnum == 691
replace ces08_cps_intday = 29 if ces08_idnum == 693
replace ces08_cps_intday = 3 if ces08_idnum == 694
replace ces08_cps_intday = 8 if ces08_idnum == 697
replace ces08_cps_intday = 9 if ces08_idnum == 700
replace ces08_cps_intday = 3 if ces08_idnum == 702
replace ces08_cps_intday = 5 if ces08_idnum == 704
replace ces08_cps_intday = 30 if ces08_idnum == 708
replace ces08_cps_intday = 11 if ces08_idnum == 709
replace ces08_cps_intday = 30 if ces08_idnum == 712
replace ces08_cps_intday = 4 if ces08_idnum == 713
replace ces08_cps_intday = 30 if ces08_idnum == 715
replace ces08_cps_intday = 9 if ces08_idnum == 716
replace ces08_cps_intday = 10 if ces08_idnum == 721
replace ces08_cps_intday = 3 if ces08_idnum == 728
replace ces08_cps_intday = 29 if ces08_idnum == 730
replace ces08_cps_intday = 7 if ces08_idnum == 737
replace ces08_cps_intday = 12 if ces08_idnum == 740
replace ces08_cps_intday = 4 if ces08_idnum == 746
replace ces08_cps_intday = 4 if ces08_idnum == 753
replace ces08_cps_intday = 6 if ces08_idnum == 754
replace ces08_cps_intday = 3 if ces08_idnum == 755
replace ces08_cps_intday = 5 if ces08_idnum == 778
replace ces08_cps_intday = 4 if ces08_idnum == 779
replace ces08_cps_intday = 8 if ces08_idnum == 785
replace ces08_cps_intday = 12 if ces08_idnum == 792
replace ces08_cps_intday = 5 if ces08_idnum == 793
replace ces08_cps_intday = 12 if ces08_idnum == 807
replace ces08_cps_intday = 7 if ces08_idnum == 822
replace ces08_cps_intday = 11 if ces08_idnum == 828
replace ces08_cps_intday = 9 if ces08_idnum == 831
replace ces08_cps_intday = 13 if ces08_idnum == 840
replace ces08_cps_intday = 26 if ces08_idnum == 1004
replace ces08_cps_intday = 29 if ces08_idnum == 1005
replace ces08_cps_intday = 5 if ces08_idnum == 1011
replace ces08_cps_intday = 26 if ces08_idnum == 1013
replace ces08_cps_intday = 28 if ces08_idnum == 1017
replace ces08_cps_intday = 28 if ces08_idnum == 1019
replace ces08_cps_intday = 10 if ces08_idnum == 1021
replace ces08_cps_intday = 27 if ces08_idnum == 1023
replace ces08_cps_intday = 27 if ces08_idnum == 1027
replace ces08_cps_intday = 8 if ces08_idnum == 1030
replace ces08_cps_intday = 3 if ces08_idnum == 1032
replace ces08_cps_intday = 30 if ces08_idnum == 1033
replace ces08_cps_intday = 7 if ces08_idnum == 1038
replace ces08_cps_intday = 8 if ces08_idnum == 1044
replace ces08_cps_intday = 12 if ces08_idnum == 1047
replace ces08_cps_intday = 28 if ces08_idnum == 1054
replace ces08_cps_intday = 8 if ces08_idnum == 1057
replace ces08_cps_intday = 3 if ces08_idnum == 1061
replace ces08_cps_intday = 28 if ces08_idnum == 1063
replace ces08_cps_intday = 6 if ces08_idnum == 1068
replace ces08_cps_intday = 13 if ces08_idnum == 1069
replace ces08_cps_intday = 30 if ces08_idnum == 1070
replace ces08_cps_intday = 5 if ces08_idnum == 1079
replace ces08_cps_intday = 1 if ces08_idnum == 1081
replace ces08_cps_intday = 28 if ces08_idnum == 1082
replace ces08_cps_intday = 28 if ces08_idnum == 1083
replace ces08_cps_intday = 27 if ces08_idnum == 1087
replace ces08_cps_intday = 30 if ces08_idnum == 1088
replace ces08_cps_intday = 2 if ces08_idnum == 1089
replace ces08_cps_intday = 28 if ces08_idnum == 1091
replace ces08_cps_intday = 28 if ces08_idnum == 1097
replace ces08_cps_intday = 2 if ces08_idnum == 1098
replace ces08_cps_intday = 27 if ces08_idnum == 1099
replace ces08_cps_intday = 2 if ces08_idnum == 1102
replace ces08_cps_intday = 10 if ces08_idnum == 1105
replace ces08_cps_intday = 6 if ces08_idnum == 1107
replace ces08_cps_intday = 28 if ces08_idnum == 1108
replace ces08_cps_intday = 8 if ces08_idnum == 1120
replace ces08_cps_intday = 10 if ces08_idnum == 1123
replace ces08_cps_intday = 30 if ces08_idnum == 1124
replace ces08_cps_intday = 12 if ces08_idnum == 1127
replace ces08_cps_intday = 28 if ces08_idnum == 1131
replace ces08_cps_intday = 28 if ces08_idnum == 1132
replace ces08_cps_intday = 9 if ces08_idnum == 1134
replace ces08_cps_intday = 1 if ces08_idnum == 1137
replace ces08_cps_intday = 27 if ces08_idnum == 1140
replace ces08_cps_intday = 12 if ces08_idnum == 1148
replace ces08_cps_intday = 27 if ces08_idnum == 1149
replace ces08_cps_intday = 30 if ces08_idnum == 1150
replace ces08_cps_intday = 6 if ces08_idnum == 1151
replace ces08_cps_intday = 29 if ces08_idnum == 1153
replace ces08_cps_intday = 10 if ces08_idnum == 1156
replace ces08_cps_intday = 11 if ces08_idnum == 1160
replace ces08_cps_intday = 29 if ces08_idnum == 1161
replace ces08_cps_intday = 3 if ces08_idnum == 1162
replace ces08_cps_intday = 29 if ces08_idnum == 1164
replace ces08_cps_intday = 5 if ces08_idnum == 1166
replace ces08_cps_intday = 29 if ces08_idnum == 1168
replace ces08_cps_intday = 29 if ces08_idnum == 1170
replace ces08_cps_intday = 29 if ces08_idnum == 1173
replace ces08_cps_intday = 10 if ces08_idnum == 1185
replace ces08_cps_intday = 6 if ces08_idnum == 1186
replace ces08_cps_intday = 13 if ces08_idnum == 1188
replace ces08_cps_intday = 10 if ces08_idnum == 1189
replace ces08_cps_intday = 1 if ces08_idnum == 1193
replace ces08_cps_intday = 30 if ces08_idnum == 1197
replace ces08_cps_intday = 3 if ces08_idnum == 1200
replace ces08_cps_intday = 1 if ces08_idnum == 1202
replace ces08_cps_intday = 10 if ces08_idnum == 1204
replace ces08_cps_intday = 30 if ces08_idnum == 1205
replace ces08_cps_intday = 30 if ces08_idnum == 1213
replace ces08_cps_intday = 1 if ces08_idnum == 1218
replace ces08_cps_intday = 12 if ces08_idnum == 1220
replace ces08_cps_intday = 30 if ces08_idnum == 1222
replace ces08_cps_intday = 2 if ces08_idnum == 1226
replace ces08_cps_intday = 8 if ces08_idnum == 1231
replace ces08_cps_intday = 2 if ces08_idnum == 1234
replace ces08_cps_intday = 4 if ces08_idnum == 1236
replace ces08_cps_intday = 30 if ces08_idnum == 1240
replace ces08_cps_intday = 13 if ces08_idnum == 1241
replace ces08_cps_intday = 1 if ces08_idnum == 1245
replace ces08_cps_intday = 12 if ces08_idnum == 1248
replace ces08_cps_intday = 30 if ces08_idnum == 1249
replace ces08_cps_intday = 5 if ces08_idnum == 1252
replace ces08_cps_intday = 3 if ces08_idnum == 1255
replace ces08_cps_intday = 3 if ces08_idnum == 1257
replace ces08_cps_intday = 3 if ces08_idnum == 1263
replace ces08_cps_intday = 3 if ces08_idnum == 1266
replace ces08_cps_intday = 5 if ces08_idnum == 1267
replace ces08_cps_intday = 4 if ces08_idnum == 1269
replace ces08_cps_intday = 7 if ces08_idnum == 1271
replace ces08_cps_intday = 12 if ces08_idnum == 1274
replace ces08_cps_intday = 8 if ces08_idnum == 1275
replace ces08_cps_intday = 7 if ces08_idnum == 1278
replace ces08_cps_intday = 3 if ces08_idnum == 1292
replace ces08_cps_intday = 6 if ces08_idnum == 1293
replace ces08_cps_intday = 9 if ces08_idnum == 1297
replace ces08_cps_intday = 4 if ces08_idnum == 1298
replace ces08_cps_intday = 13 if ces08_idnum == 1299
replace ces08_cps_intday = 6 if ces08_idnum == 1301
replace ces08_cps_intday = 13 if ces08_idnum == 1307
replace ces08_cps_intday = 10 if ces08_idnum == 1334
replace ces08_cps_intday = 27 if ces08_idnum == 1501
replace ces08_cps_intday = 11 if ces08_idnum == 1503
replace ces08_cps_intday = 27 if ces08_idnum == 1504
replace ces08_cps_intday = 7 if ces08_idnum == 1505
replace ces08_cps_intday = 26 if ces08_idnum == 1506
replace ces08_cps_intday = 12 if ces08_idnum == 1507
replace ces08_cps_intday = 7 if ces08_idnum == 1509
replace ces08_cps_intday = 26 if ces08_idnum == 1511
replace ces08_cps_intday = 12 if ces08_idnum == 1514
replace ces08_cps_intday = 30 if ces08_idnum == 1519
replace ces08_cps_intday = 9 if ces08_idnum == 1522
replace ces08_cps_intday = 27 if ces08_idnum == 1526
replace ces08_cps_intday = 28 if ces08_idnum == 1527
replace ces08_cps_intday = 6 if ces08_idnum == 1528
replace ces08_cps_intday = 29 if ces08_idnum == 1530
replace ces08_cps_intday = 30 if ces08_idnum == 1535
replace ces08_cps_intday = 8 if ces08_idnum == 1538
replace ces08_cps_intday = 28 if ces08_idnum == 1539
replace ces08_cps_intday = 28 if ces08_idnum == 1542
replace ces08_cps_intday = 28 if ces08_idnum == 1543
replace ces08_cps_intday = 30 if ces08_idnum == 1545
replace ces08_cps_intday = 10 if ces08_idnum == 1546
replace ces08_cps_intday = 27 if ces08_idnum == 1547
replace ces08_cps_intday = 28 if ces08_idnum == 1551
replace ces08_cps_intday = 3 if ces08_idnum == 1555
replace ces08_cps_intday = 27 if ces08_idnum == 1556
replace ces08_cps_intday = 28 if ces08_idnum == 1560
replace ces08_cps_intday = 5 if ces08_idnum == 1564
replace ces08_cps_intday = 6 if ces08_idnum == 1566
replace ces08_cps_intday = 30 if ces08_idnum == 1568
replace ces08_cps_intday = 28 if ces08_idnum == 1569
replace ces08_cps_intday = 27 if ces08_idnum == 1570
replace ces08_cps_intday = 30 if ces08_idnum == 1573
replace ces08_cps_intday = 29 if ces08_idnum == 1574
replace ces08_cps_intday = 27 if ces08_idnum == 1582
replace ces08_cps_intday = 27 if ces08_idnum == 1588
replace ces08_cps_intday = 30 if ces08_idnum == 1589
replace ces08_cps_intday = 27 if ces08_idnum == 1591
replace ces08_cps_intday = 28 if ces08_idnum == 1592
replace ces08_cps_intday = 28 if ces08_idnum == 1593
replace ces08_cps_intday = 27 if ces08_idnum == 1594
replace ces08_cps_intday = 27 if ces08_idnum == 1596
replace ces08_cps_intday = 9 if ces08_idnum == 1597
replace ces08_cps_intday = 8 if ces08_idnum == 1598
replace ces08_cps_intday = 27 if ces08_idnum == 1599
replace ces08_cps_intday = 28 if ces08_idnum == 1601
replace ces08_cps_intday = 27 if ces08_idnum == 1602
replace ces08_cps_intday = 10 if ces08_idnum == 1604
replace ces08_cps_intday = 27 if ces08_idnum == 1606
replace ces08_cps_intday = 30 if ces08_idnum == 1607
replace ces08_cps_intday = 30 if ces08_idnum == 1608
replace ces08_cps_intday = 30 if ces08_idnum == 1609
replace ces08_cps_intday = 9 if ces08_idnum == 1610
replace ces08_cps_intday = 2 if ces08_idnum == 1611
replace ces08_cps_intday = 27 if ces08_idnum == 1613
replace ces08_cps_intday = 30 if ces08_idnum == 1616
replace ces08_cps_intday = 27 if ces08_idnum == 1619
replace ces08_cps_intday = 27 if ces08_idnum == 1620
replace ces08_cps_intday = 12 if ces08_idnum == 1622
replace ces08_cps_intday = 5 if ces08_idnum == 1625
replace ces08_cps_intday = 27 if ces08_idnum == 1629
replace ces08_cps_intday = 27 if ces08_idnum == 1630
replace ces08_cps_intday = 29 if ces08_idnum == 1631
replace ces08_cps_intday = 28 if ces08_idnum == 1635
replace ces08_cps_intday = 29 if ces08_idnum == 1638
replace ces08_cps_intday = 8 if ces08_idnum == 1639
replace ces08_cps_intday = 7 if ces08_idnum == 1649
replace ces08_cps_intday = 1 if ces08_idnum == 1651
replace ces08_cps_intday = 3 if ces08_idnum == 1652
replace ces08_cps_intday = 29 if ces08_idnum == 1655
replace ces08_cps_intday = 30 if ces08_idnum == 1658
replace ces08_cps_intday = 29 if ces08_idnum == 1660
replace ces08_cps_intday = 30 if ces08_idnum == 1662
replace ces08_cps_intday = 29 if ces08_idnum == 1663
replace ces08_cps_intday = 2 if ces08_idnum == 1665
replace ces08_cps_intday = 29 if ces08_idnum == 1667
replace ces08_cps_intday = 30 if ces08_idnum == 1668
replace ces08_cps_intday = 29 if ces08_idnum == 1669
replace ces08_cps_intday = 29 if ces08_idnum == 1675
replace ces08_cps_intday = 29 if ces08_idnum == 1682
replace ces08_cps_intday = 29 if ces08_idnum == 1684
replace ces08_cps_intday = 29 if ces08_idnum == 1685
replace ces08_cps_intday = 4 if ces08_idnum == 1689
replace ces08_cps_intday = 4 if ces08_idnum == 1690
replace ces08_cps_intday = 1 if ces08_idnum == 1691
replace ces08_cps_intday = 1 if ces08_idnum == 1693
replace ces08_cps_intday = 4 if ces08_idnum == 1694
replace ces08_cps_intday = 12 if ces08_idnum == 1696
replace ces08_cps_intday = 1 if ces08_idnum == 1699
replace ces08_cps_intday = 1 if ces08_idnum == 1706
replace ces08_cps_intday = 1 if ces08_idnum == 1709
replace ces08_cps_intday = 30 if ces08_idnum == 1710
replace ces08_cps_intday = 29 if ces08_idnum == 1711
replace ces08_cps_intday = 5 if ces08_idnum == 1713
replace ces08_cps_intday = 2 if ces08_idnum == 1717
replace ces08_cps_intday = 2 if ces08_idnum == 1719
replace ces08_cps_intday = 10 if ces08_idnum == 1720
replace ces08_cps_intday = 12 if ces08_idnum == 1724
replace ces08_cps_intday = 2 if ces08_idnum == 1727
replace ces08_cps_intday = 7 if ces08_idnum == 1729
replace ces08_cps_intday = 2 if ces08_idnum == 1731
replace ces08_cps_intday = 9 if ces08_idnum == 1734
replace ces08_cps_intday = 7 if ces08_idnum == 1735
replace ces08_cps_intday = 5 if ces08_idnum == 1736
replace ces08_cps_intday = 30 if ces08_idnum == 1742
replace ces08_cps_intday = 30 if ces08_idnum == 1743
replace ces08_cps_intday = 2 if ces08_idnum == 1745
replace ces08_cps_intday = 2 if ces08_idnum == 1747
replace ces08_cps_intday = 30 if ces08_idnum == 1749
replace ces08_cps_intday = 27 if ces08_idnum == 2001
replace ces08_cps_intday = 11 if ces08_idnum == 2005
replace ces08_cps_intday = 7 if ces08_idnum == 2006
replace ces08_cps_intday = 27 if ces08_idnum == 2007
replace ces08_cps_intday = 26 if ces08_idnum == 2011
replace ces08_cps_intday = 27 if ces08_idnum == 2018
replace ces08_cps_intday = 9 if ces08_idnum == 2020
replace ces08_cps_intday = 13 if ces08_idnum == 2025
replace ces08_cps_intday = 7 if ces08_idnum == 2034
replace ces08_cps_intday = 5 if ces08_idnum == 2036
replace ces08_cps_intday = 7 if ces08_idnum == 2038
replace ces08_cps_intday = 27 if ces08_idnum == 2039
replace ces08_cps_intday = 9 if ces08_idnum == 2040
replace ces08_cps_intday = 30 if ces08_idnum == 2042
replace ces08_cps_intday = 29 if ces08_idnum == 2048
replace ces08_cps_intday = 27 if ces08_idnum == 2049
replace ces08_cps_intday = 12 if ces08_idnum == 2050
replace ces08_cps_intday = 5 if ces08_idnum == 2052
replace ces08_cps_intday = 27 if ces08_idnum == 2059
replace ces08_cps_intday = 3 if ces08_idnum == 2063
replace ces08_cps_intday = 29 if ces08_idnum == 2064
replace ces08_cps_intday = 29 if ces08_idnum == 2067
replace ces08_cps_intday = 27 if ces08_idnum == 2069
replace ces08_cps_intday = 2 if ces08_idnum == 2071
replace ces08_cps_intday = 5 if ces08_idnum == 2074
replace ces08_cps_intday = 27 if ces08_idnum == 2075
replace ces08_cps_intday = 13 if ces08_idnum == 2078
replace ces08_cps_intday = 27 if ces08_idnum == 2079
replace ces08_cps_intday = 28 if ces08_idnum == 2082
replace ces08_cps_intday = 29 if ces08_idnum == 2084
replace ces08_cps_intday = 27 if ces08_idnum == 2088
replace ces08_cps_intday = 29 if ces08_idnum == 2092
replace ces08_cps_intday = 27 if ces08_idnum == 2094
replace ces08_cps_intday = 29 if ces08_idnum == 2096
replace ces08_cps_intday = 27 if ces08_idnum == 2100
replace ces08_cps_intday = 10 if ces08_idnum == 2101
replace ces08_cps_intday = 30 if ces08_idnum == 2110
replace ces08_cps_intday = 2 if ces08_idnum == 2112
replace ces08_cps_intday = 29 if ces08_idnum == 2113
replace ces08_cps_intday = 30 if ces08_idnum == 2115
replace ces08_cps_intday = 1 if ces08_idnum == 2116
replace ces08_cps_intday = 13 if ces08_idnum == 2122
replace ces08_cps_intday = 11 if ces08_idnum == 2124
replace ces08_cps_intday = 13 if ces08_idnum == 2125
replace ces08_cps_intday = 12 if ces08_idnum == 2126
replace ces08_cps_intday = 5 if ces08_idnum == 2128
replace ces08_cps_intday = 3 if ces08_idnum == 2131
replace ces08_cps_intday = 29 if ces08_idnum == 2132
replace ces08_cps_intday = 11 if ces08_idnum == 2134
replace ces08_cps_intday = 12 if ces08_idnum == 2137
replace ces08_cps_intday = 27 if ces08_idnum == 2143
replace ces08_cps_intday = 30 if ces08_idnum == 2145
replace ces08_cps_intday = 27 if ces08_idnum == 2150
replace ces08_cps_intday = 13 if ces08_idnum == 2153
replace ces08_cps_intday = 5 if ces08_idnum == 2155
replace ces08_cps_intday = 4 if ces08_idnum == 2160
replace ces08_cps_intday = 7 if ces08_idnum == 2162
replace ces08_cps_intday = 30 if ces08_idnum == 2170
replace ces08_cps_intday = 4 if ces08_idnum == 2171
replace ces08_cps_intday = 30 if ces08_idnum == 2180
replace ces08_cps_intday = 30 if ces08_idnum == 2183
replace ces08_cps_intday = 29 if ces08_idnum == 2184
replace ces08_cps_intday = 28 if ces08_idnum == 2185
replace ces08_cps_intday = 2 if ces08_idnum == 2186
replace ces08_cps_intday = 29 if ces08_idnum == 2187
replace ces08_cps_intday = 27 if ces08_idnum == 2188
replace ces08_cps_intday = 29 if ces08_idnum == 2190
replace ces08_cps_intday = 3 if ces08_idnum == 2191
replace ces08_cps_intday = 3 if ces08_idnum == 2193
replace ces08_cps_intday = 29 if ces08_idnum == 2194
replace ces08_cps_intday = 12 if ces08_idnum == 2195
replace ces08_cps_intday = 29 if ces08_idnum == 2198
replace ces08_cps_intday = 26 if ces08_idnum == 2201
replace ces08_cps_intday = 3 if ces08_idnum == 2202
replace ces08_cps_intday = 1 if ces08_idnum == 2206
replace ces08_cps_intday = 5 if ces08_idnum == 2207
replace ces08_cps_intday = 30 if ces08_idnum == 2211
replace ces08_cps_intday = 29 if ces08_idnum == 2212
replace ces08_cps_intday = 27 if ces08_idnum == 2218
replace ces08_cps_intday = 26 if ces08_idnum == 2221
replace ces08_cps_intday = 9 if ces08_idnum == 2222
replace ces08_cps_intday = 10 if ces08_idnum == 2224
replace ces08_cps_intday = 3 if ces08_idnum == 2226
replace ces08_cps_intday = 30 if ces08_idnum == 2228
replace ces08_cps_intday = 27 if ces08_idnum == 2230
replace ces08_cps_intday = 7 if ces08_idnum == 2232
replace ces08_cps_intday = 7 if ces08_idnum == 2233
replace ces08_cps_intday = 27 if ces08_idnum == 2234
replace ces08_cps_intday = 2 if ces08_idnum == 2239
replace ces08_cps_intday = 5 if ces08_idnum == 2241
replace ces08_cps_intday = 3 if ces08_idnum == 2242
replace ces08_cps_intday = 27 if ces08_idnum == 2246
replace ces08_cps_intday = 13 if ces08_idnum == 2248
replace ces08_cps_intday = 29 if ces08_idnum == 2250
replace ces08_cps_intday = 27 if ces08_idnum == 2251
replace ces08_cps_intday = 27 if ces08_idnum == 2252
replace ces08_cps_intday = 30 if ces08_idnum == 2254
replace ces08_cps_intday = 1 if ces08_idnum == 2256
replace ces08_cps_intday = 8 if ces08_idnum == 2259
replace ces08_cps_intday = 27 if ces08_idnum == 2261
replace ces08_cps_intday = 27 if ces08_idnum == 2262
replace ces08_cps_intday = 27 if ces08_idnum == 2263
replace ces08_cps_intday = 3 if ces08_idnum == 2264
replace ces08_cps_intday = 28 if ces08_idnum == 2266
replace ces08_cps_intday = 4 if ces08_idnum == 2270
replace ces08_cps_intday = 9 if ces08_idnum == 2272
replace ces08_cps_intday = 13 if ces08_idnum == 2275
replace ces08_cps_intday = 7 if ces08_idnum == 2276
replace ces08_cps_intday = 4 if ces08_idnum == 2280
replace ces08_cps_intday = 1 if ces08_idnum == 2281
replace ces08_cps_intday = 10 if ces08_idnum == 2284
replace ces08_cps_intday = 5 if ces08_idnum == 2285
replace ces08_cps_intday = 1 if ces08_idnum == 2286
replace ces08_cps_intday = 27 if ces08_idnum == 2287
replace ces08_cps_intday = 5 if ces08_idnum == 2288
replace ces08_cps_intday = 30 if ces08_idnum == 2291
replace ces08_cps_intday = 30 if ces08_idnum == 2292
replace ces08_cps_intday = 10 if ces08_idnum == 2293
replace ces08_cps_intday = 27 if ces08_idnum == 2294
replace ces08_cps_intday = 29 if ces08_idnum == 2295
replace ces08_cps_intday = 10 if ces08_idnum == 2300
replace ces08_cps_intday = 30 if ces08_idnum == 2302
replace ces08_cps_intday = 27 if ces08_idnum == 2304
replace ces08_cps_intday = 7 if ces08_idnum == 2309
replace ces08_cps_intday = 13 if ces08_idnum == 2311
replace ces08_cps_intday = 3 if ces08_idnum == 2315
replace ces08_cps_intday = 2 if ces08_idnum == 2316
replace ces08_cps_intday = 28 if ces08_idnum == 2317
replace ces08_cps_intday = 8 if ces08_idnum == 2320
replace ces08_cps_intday = 7 if ces08_idnum == 2321
replace ces08_cps_intday = 13 if ces08_idnum == 2323
replace ces08_cps_intday = 27 if ces08_idnum == 2326
replace ces08_cps_intday = 30 if ces08_idnum == 2327
replace ces08_cps_intday = 7 if ces08_idnum == 2331
replace ces08_cps_intday = 27 if ces08_idnum == 2333
replace ces08_cps_intday = 1 if ces08_idnum == 2336
replace ces08_cps_intday = 3 if ces08_idnum == 2339
replace ces08_cps_intday = 28 if ces08_idnum == 2343
replace ces08_cps_intday = 28 if ces08_idnum == 2350
replace ces08_cps_intday = 13 if ces08_idnum == 2352
replace ces08_cps_intday = 28 if ces08_idnum == 2361
replace ces08_cps_intday = 28 if ces08_idnum == 2367
replace ces08_cps_intday = 27 if ces08_idnum == 2374
replace ces08_cps_intday = 29 if ces08_idnum == 2376
replace ces08_cps_intday = 27 if ces08_idnum == 2378
replace ces08_cps_intday = 8 if ces08_idnum == 2380
replace ces08_cps_intday = 27 if ces08_idnum == 2383
replace ces08_cps_intday = 10 if ces08_idnum == 2388
replace ces08_cps_intday = 2 if ces08_idnum == 2390
replace ces08_cps_intday = 1 if ces08_idnum == 2391
replace ces08_cps_intday = 5 if ces08_idnum == 2394
replace ces08_cps_intday = 1 if ces08_idnum == 2400
replace ces08_cps_intday = 2 if ces08_idnum == 2401
replace ces08_cps_intday = 9 if ces08_idnum == 2404
replace ces08_cps_intday = 29 if ces08_idnum == 2405
replace ces08_cps_intday = 29 if ces08_idnum == 2414
replace ces08_cps_intday = 10 if ces08_idnum == 2415
replace ces08_cps_intday = 8 if ces08_idnum == 2417
replace ces08_cps_intday = 8 if ces08_idnum == 2418
replace ces08_cps_intday = 7 if ces08_idnum == 2421
replace ces08_cps_intday = 27 if ces08_idnum == 2424
replace ces08_cps_intday = 27 if ces08_idnum == 2430
replace ces08_cps_intday = 4 if ces08_idnum == 2432
replace ces08_cps_intday = 27 if ces08_idnum == 2438
replace ces08_cps_intday = 1 if ces08_idnum == 2441
replace ces08_cps_intday = 30 if ces08_idnum == 2442
replace ces08_cps_intday = 27 if ces08_idnum == 2449
replace ces08_cps_intday = 28 if ces08_idnum == 2458
replace ces08_cps_intday = 30 if ces08_idnum == 2460
replace ces08_cps_intday = 2 if ces08_idnum == 2461
replace ces08_cps_intday = 13 if ces08_idnum == 2464
replace ces08_cps_intday = 7 if ces08_idnum == 2469
replace ces08_cps_intday = 12 if ces08_idnum == 2471
replace ces08_cps_intday = 13 if ces08_idnum == 2475
replace ces08_cps_intday = 6 if ces08_idnum == 2476
replace ces08_cps_intday = 27 if ces08_idnum == 2477
replace ces08_cps_intday = 9 if ces08_idnum == 2480
replace ces08_cps_intday = 6 if ces08_idnum == 2486
replace ces08_cps_intday = 27 if ces08_idnum == 2489
replace ces08_cps_intday = 6 if ces08_idnum == 2494
replace ces08_cps_intday = 11 if ces08_idnum == 2497
replace ces08_cps_intday = 2 if ces08_idnum == 2502
replace ces08_cps_intday = 29 if ces08_idnum == 2504
replace ces08_cps_intday = 27 if ces08_idnum == 2508
replace ces08_cps_intday = 12 if ces08_idnum == 2509
replace ces08_cps_intday = 30 if ces08_idnum == 2511
replace ces08_cps_intday = 30 if ces08_idnum == 2512
replace ces08_cps_intday = 30 if ces08_idnum == 2513
replace ces08_cps_intday = 10 if ces08_idnum == 2516
replace ces08_cps_intday = 1 if ces08_idnum == 2518
replace ces08_cps_intday = 13 if ces08_idnum == 2525
replace ces08_cps_intday = 27 if ces08_idnum == 2528
replace ces08_cps_intday = 9 if ces08_idnum == 2531
replace ces08_cps_intday = 27 if ces08_idnum == 2533
replace ces08_cps_intday = 28 if ces08_idnum == 2535
replace ces08_cps_intday = 2 if ces08_idnum == 2536
replace ces08_cps_intday = 27 if ces08_idnum == 2540
replace ces08_cps_intday = 12 if ces08_idnum == 2545
replace ces08_cps_intday = 11 if ces08_idnum == 2546
replace ces08_cps_intday = 8 if ces08_idnum == 2547
replace ces08_cps_intday = 30 if ces08_idnum == 2548
replace ces08_cps_intday = 1 if ces08_idnum == 2552
replace ces08_cps_intday = 4 if ces08_idnum == 2554
replace ces08_cps_intday = 8 if ces08_idnum == 2558
replace ces08_cps_intday = 4 if ces08_idnum == 2570
replace ces08_cps_intday = 4 if ces08_idnum == 2571
replace ces08_cps_intday = 30 if ces08_idnum == 2575
replace ces08_cps_intday = 30 if ces08_idnum == 2584
replace ces08_cps_intday = 28 if ces08_idnum == 2588
replace ces08_cps_intday = 28 if ces08_idnum == 2590
replace ces08_cps_intday = 30 if ces08_idnum == 2592
replace ces08_cps_intday = 30 if ces08_idnum == 2594
replace ces08_cps_intday = 28 if ces08_idnum == 2595
replace ces08_cps_intday = 29 if ces08_idnum == 2602
replace ces08_cps_intday = 27 if ces08_idnum == 2605
replace ces08_cps_intday = 30 if ces08_idnum == 2610
replace ces08_cps_intday = 2 if ces08_idnum == 2612
replace ces08_cps_intday = 27 if ces08_idnum == 2613
replace ces08_cps_intday = 1 if ces08_idnum == 2614
replace ces08_cps_intday = 1 if ces08_idnum == 2616
replace ces08_cps_intday = 5 if ces08_idnum == 2618
replace ces08_cps_intday = 4 if ces08_idnum == 2620
replace ces08_cps_intday = 1 if ces08_idnum == 2622
replace ces08_cps_intday = 1 if ces08_idnum == 2623
replace ces08_cps_intday = 10 if ces08_idnum == 2624
replace ces08_cps_intday = 27 if ces08_idnum == 2625
replace ces08_cps_intday = 10 if ces08_idnum == 2631
replace ces08_cps_intday = 27 if ces08_idnum == 2634
replace ces08_cps_intday = 27 if ces08_idnum == 2636
replace ces08_cps_intday = 30 if ces08_idnum == 2639
replace ces08_cps_intday = 27 if ces08_idnum == 2640
replace ces08_cps_intday = 29 if ces08_idnum == 2643
replace ces08_cps_intday = 1 if ces08_idnum == 2649
replace ces08_cps_intday = 28 if ces08_idnum == 2650
replace ces08_cps_intday = 29 if ces08_idnum == 2653
replace ces08_cps_intday = 30 if ces08_idnum == 2654
replace ces08_cps_intday = 2 if ces08_idnum == 2656
replace ces08_cps_intday = 27 if ces08_idnum == 2657
replace ces08_cps_intday = 28 if ces08_idnum == 2658
replace ces08_cps_intday = 27 if ces08_idnum == 2661
replace ces08_cps_intday = 8 if ces08_idnum == 2662
replace ces08_cps_intday = 28 if ces08_idnum == 2665
replace ces08_cps_intday = 3 if ces08_idnum == 2666
replace ces08_cps_intday = 8 if ces08_idnum == 2672
replace ces08_cps_intday = 29 if ces08_idnum == 2675
replace ces08_cps_intday = 5 if ces08_idnum == 2676
replace ces08_cps_intday = 12 if ces08_idnum == 2677
replace ces08_cps_intday = 27 if ces08_idnum == 2680
replace ces08_cps_intday = 29 if ces08_idnum == 2683
replace ces08_cps_intday = 2 if ces08_idnum == 2685
replace ces08_cps_intday = 27 if ces08_idnum == 2686
replace ces08_cps_intday = 13 if ces08_idnum == 2691
replace ces08_cps_intday = 13 if ces08_idnum == 2698
replace ces08_cps_intday = 27 if ces08_idnum == 2700
replace ces08_cps_intday = 30 if ces08_idnum == 2701
replace ces08_cps_intday = 27 if ces08_idnum == 2703
replace ces08_cps_intday = 27 if ces08_idnum == 2704
replace ces08_cps_intday = 4 if ces08_idnum == 2705
replace ces08_cps_intday = 12 if ces08_idnum == 2708
replace ces08_cps_intday = 28 if ces08_idnum == 2710
replace ces08_cps_intday = 10 if ces08_idnum == 2713
replace ces08_cps_intday = 27 if ces08_idnum == 2716
replace ces08_cps_intday = 28 if ces08_idnum == 2718
replace ces08_cps_intday = 4 if ces08_idnum == 2719
replace ces08_cps_intday = 2 if ces08_idnum == 2721
replace ces08_cps_intday = 9 if ces08_idnum == 2723
replace ces08_cps_intday = 4 if ces08_idnum == 2727
replace ces08_cps_intday = 27 if ces08_idnum == 2730
replace ces08_cps_intday = 4 if ces08_idnum == 2732
replace ces08_cps_intday = 29 if ces08_idnum == 2735
replace ces08_cps_intday = 27 if ces08_idnum == 2736
replace ces08_cps_intday = 4 if ces08_idnum == 2737
replace ces08_cps_intday = 1 if ces08_idnum == 2743
replace ces08_cps_intday = 13 if ces08_idnum == 2752
replace ces08_cps_intday = 30 if ces08_idnum == 2755
replace ces08_cps_intday = 11 if ces08_idnum == 2757
replace ces08_cps_intday = 6 if ces08_idnum == 2759
replace ces08_cps_intday = 9 if ces08_idnum == 2760
replace ces08_cps_intday = 5 if ces08_idnum == 2761
replace ces08_cps_intday = 4 if ces08_idnum == 2771
replace ces08_cps_intday = 3 if ces08_idnum == 2772
replace ces08_cps_intday = 11 if ces08_idnum == 2775
replace ces08_cps_intday = 29 if ces08_idnum == 2776
replace ces08_cps_intday = 30 if ces08_idnum == 2778
replace ces08_cps_intday = 12 if ces08_idnum == 2780
replace ces08_cps_intday = 5 if ces08_idnum == 2783
replace ces08_cps_intday = 29 if ces08_idnum == 2788
replace ces08_cps_intday = 27 if ces08_idnum == 2790
replace ces08_cps_intday = 10 if ces08_idnum == 2791
replace ces08_cps_intday = 1 if ces08_idnum == 2793
replace ces08_cps_intday = 29 if ces08_idnum == 2797
replace ces08_cps_intday = 28 if ces08_idnum == 2799
replace ces08_cps_intday = 3 if ces08_idnum == 2801
replace ces08_cps_intday = 4 if ces08_idnum == 2803
replace ces08_cps_intday = 6 if ces08_idnum == 2804
replace ces08_cps_intday = 5 if ces08_idnum == 2808
replace ces08_cps_intday = 10 if ces08_idnum == 2809
replace ces08_cps_intday = 28 if ces08_idnum == 2813
replace ces08_cps_intday = 3 if ces08_idnum == 2819
replace ces08_cps_intday = 27 if ces08_idnum == 2823
replace ces08_cps_intday = 30 if ces08_idnum == 2824
replace ces08_cps_intday = 8 if ces08_idnum == 2829
replace ces08_cps_intday = 29 if ces08_idnum == 2830
replace ces08_cps_intday = 27 if ces08_idnum == 2832
replace ces08_cps_intday = 27 if ces08_idnum == 2833
replace ces08_cps_intday = 10 if ces08_idnum == 2839
replace ces08_cps_intday = 27 if ces08_idnum == 2841
replace ces08_cps_intday = 2 if ces08_idnum == 2843
replace ces08_cps_intday = 29 if ces08_idnum == 2847
replace ces08_cps_intday = 28 if ces08_idnum == 2852
replace ces08_cps_intday = 27 if ces08_idnum == 2856
replace ces08_cps_intday = 28 if ces08_idnum == 2860
replace ces08_cps_intday = 29 if ces08_idnum == 2861
replace ces08_cps_intday = 30 if ces08_idnum == 2862
replace ces08_cps_intday = 29 if ces08_idnum == 2866
replace ces08_cps_intday = 27 if ces08_idnum == 2871
replace ces08_cps_intday = 12 if ces08_idnum == 2874
replace ces08_cps_intday = 27 if ces08_idnum == 2876
replace ces08_cps_intday = 27 if ces08_idnum == 2885
replace ces08_cps_intday = 8 if ces08_idnum == 2887
replace ces08_cps_intday = 29 if ces08_idnum == 2894
replace ces08_cps_intday = 27 if ces08_idnum == 2896
replace ces08_cps_intday = 12 if ces08_idnum == 2898
replace ces08_cps_intday = 2 if ces08_idnum == 2905
replace ces08_cps_intday = 29 if ces08_idnum == 2906
replace ces08_cps_intday = 29 if ces08_idnum == 2910
replace ces08_cps_intday = 28 if ces08_idnum == 2911
replace ces08_cps_intday = 1 if ces08_idnum == 2912
replace ces08_cps_intday = 29 if ces08_idnum == 2916
replace ces08_cps_intday = 3 if ces08_idnum == 2924
replace ces08_cps_intday = 4 if ces08_idnum == 2925
replace ces08_cps_intday = 2 if ces08_idnum == 2926
replace ces08_cps_intday = 27 if ces08_idnum == 2931
replace ces08_cps_intday = 27 if ces08_idnum == 2933
replace ces08_cps_intday = 8 if ces08_idnum == 2938
replace ces08_cps_intday = 29 if ces08_idnum == 2940
replace ces08_cps_intday = 27 if ces08_idnum == 2941
replace ces08_cps_intday = 2 if ces08_idnum == 2942
replace ces08_cps_intday = 29 if ces08_idnum == 2949
replace ces08_cps_intday = 5 if ces08_idnum == 2951
replace ces08_cps_intday = 29 if ces08_idnum == 2954
replace ces08_cps_intday = 27 if ces08_idnum == 2958
replace ces08_cps_intday = 29 if ces08_idnum == 2960
replace ces08_cps_intday = 28 if ces08_idnum == 2961
replace ces08_cps_intday = 2 if ces08_idnum == 2962
replace ces08_cps_intday = 27 if ces08_idnum == 2964
replace ces08_cps_intday = 13 if ces08_idnum == 2965
replace ces08_cps_intday = 28 if ces08_idnum == 2967
replace ces08_cps_intday = 27 if ces08_idnum == 2970
replace ces08_cps_intday = 27 if ces08_idnum == 2974
replace ces08_cps_intday = 6 if ces08_idnum == 2976
replace ces08_cps_intday = 30 if ces08_idnum == 2981
replace ces08_cps_intday = 6 if ces08_idnum == 2982
replace ces08_cps_intday = 29 if ces08_idnum == 2984
replace ces08_cps_intday = 27 if ces08_idnum == 2986
replace ces08_cps_intday = 8 if ces08_idnum == 2987
replace ces08_cps_intday = 30 if ces08_idnum == 2991
replace ces08_cps_intday = 29 if ces08_idnum == 2993
replace ces08_cps_intday = 30 if ces08_idnum == 3001
replace ces08_cps_intday = 6 if ces08_idnum == 3003
replace ces08_cps_intday = 11 if ces08_idnum == 3006
replace ces08_cps_intday = 30 if ces08_idnum == 3012
replace ces08_cps_intday = 29 if ces08_idnum == 3014
replace ces08_cps_intday = 27 if ces08_idnum == 3016
replace ces08_cps_intday = 11 if ces08_idnum == 3020
replace ces08_cps_intday = 29 if ces08_idnum == 3027
replace ces08_cps_intday = 28 if ces08_idnum == 3028
replace ces08_cps_intday = 1 if ces08_idnum == 3029
replace ces08_cps_intday = 27 if ces08_idnum == 3033
replace ces08_cps_intday = 28 if ces08_idnum == 3036
replace ces08_cps_intday = 9 if ces08_idnum == 3038
replace ces08_cps_intday = 13 if ces08_idnum == 3041
replace ces08_cps_intday = 27 if ces08_idnum == 3047
replace ces08_cps_intday = 8 if ces08_idnum == 3049
replace ces08_cps_intday = 10 if ces08_idnum == 3053
replace ces08_cps_intday = 2 if ces08_idnum == 3054
replace ces08_cps_intday = 6 if ces08_idnum == 3056
replace ces08_cps_intday = 3 if ces08_idnum == 3059
replace ces08_cps_intday = 28 if ces08_idnum == 3061
replace ces08_cps_intday = 10 if ces08_idnum == 3063
replace ces08_cps_intday = 1 if ces08_idnum == 3064
replace ces08_cps_intday = 30 if ces08_idnum == 3066
replace ces08_cps_intday = 27 if ces08_idnum == 3069
replace ces08_cps_intday = 8 if ces08_idnum == 3071
replace ces08_cps_intday = 6 if ces08_idnum == 3072
replace ces08_cps_intday = 27 if ces08_idnum == 3073
replace ces08_cps_intday = 29 if ces08_idnum == 3074
replace ces08_cps_intday = 27 if ces08_idnum == 3075
replace ces08_cps_intday = 6 if ces08_idnum == 3076
replace ces08_cps_intday = 3 if ces08_idnum == 3077
replace ces08_cps_intday = 7 if ces08_idnum == 3078
replace ces08_cps_intday = 2 if ces08_idnum == 3079
replace ces08_cps_intday = 30 if ces08_idnum == 3080
replace ces08_cps_intday = 12 if ces08_idnum == 3081
replace ces08_cps_intday = 6 if ces08_idnum == 3085
replace ces08_cps_intday = 29 if ces08_idnum == 3086
replace ces08_cps_intday = 3 if ces08_idnum == 3087
replace ces08_cps_intday = 29 if ces08_idnum == 3089
replace ces08_cps_intday = 3 if ces08_idnum == 3091
replace ces08_cps_intday = 10 if ces08_idnum == 3093
replace ces08_cps_intday = 2 if ces08_idnum == 3094
replace ces08_cps_intday = 3 if ces08_idnum == 3095
replace ces08_cps_intday = 2 if ces08_idnum == 3096
replace ces08_cps_intday = 30 if ces08_idnum == 3108
replace ces08_cps_intday = 10 if ces08_idnum == 3112
replace ces08_cps_intday = 29 if ces08_idnum == 3113
replace ces08_cps_intday = 9 if ces08_idnum == 3116
replace ces08_cps_intday = 2 if ces08_idnum == 3125
replace ces08_cps_intday = 7 if ces08_idnum == 3126
replace ces08_cps_intday = 11 if ces08_idnum == 3127
replace ces08_cps_intday = 29 if ces08_idnum == 3132
replace ces08_cps_intday = 28 if ces08_idnum == 3134
replace ces08_cps_intday = 4 if ces08_idnum == 3135
replace ces08_cps_intday = 2 if ces08_idnum == 3136
replace ces08_cps_intday = 3 if ces08_idnum == 3137
replace ces08_cps_intday = 28 if ces08_idnum == 3138
replace ces08_cps_intday = 2 if ces08_idnum == 3139
replace ces08_cps_intday = 3 if ces08_idnum == 3142
replace ces08_cps_intday = 6 if ces08_idnum == 3144
replace ces08_cps_intday = 28 if ces08_idnum == 3146
replace ces08_cps_intday = 3 if ces08_idnum == 3151
replace ces08_cps_intday = 6 if ces08_idnum == 3155
replace ces08_cps_intday = 13 if ces08_idnum == 3158
replace ces08_cps_intday = 2 if ces08_idnum == 3160
replace ces08_cps_intday = 4 if ces08_idnum == 3165
replace ces08_cps_intday = 30 if ces08_idnum == 3169
replace ces08_cps_intday = 29 if ces08_idnum == 3172
replace ces08_cps_intday = 9 if ces08_idnum == 3174
replace ces08_cps_intday = 9 if ces08_idnum == 3176
replace ces08_cps_intday = 29 if ces08_idnum == 3177
replace ces08_cps_intday = 29 if ces08_idnum == 3179
replace ces08_cps_intday = 8 if ces08_idnum == 3184
replace ces08_cps_intday = 29 if ces08_idnum == 3186
replace ces08_cps_intday = 28 if ces08_idnum == 3187
replace ces08_cps_intday = 3 if ces08_idnum == 3189
replace ces08_cps_intday = 28 if ces08_idnum == 3190
replace ces08_cps_intday = 29 if ces08_idnum == 3192
replace ces08_cps_intday = 28 if ces08_idnum == 3193
replace ces08_cps_intday = 1 if ces08_idnum == 3194
replace ces08_cps_intday = 29 if ces08_idnum == 3195
replace ces08_cps_intday = 28 if ces08_idnum == 3201
replace ces08_cps_intday = 28 if ces08_idnum == 3203
replace ces08_cps_intday = 28 if ces08_idnum == 3206
replace ces08_cps_intday = 3 if ces08_idnum == 3208
replace ces08_cps_intday = 30 if ces08_idnum == 3218
replace ces08_cps_intday = 3 if ces08_idnum == 3219
replace ces08_cps_intday = 8 if ces08_idnum == 3220
replace ces08_cps_intday = 8 if ces08_idnum == 3222
replace ces08_cps_intday = 29 if ces08_idnum == 3226
replace ces08_cps_intday = 2 if ces08_idnum == 3227
replace ces08_cps_intday = 30 if ces08_idnum == 3232
replace ces08_cps_intday = 4 if ces08_idnum == 3233
replace ces08_cps_intday = 28 if ces08_idnum == 3235
replace ces08_cps_intday = 29 if ces08_idnum == 3239
replace ces08_cps_intday = 3 if ces08_idnum == 3244
replace ces08_cps_intday = 3 if ces08_idnum == 3246
replace ces08_cps_intday = 10 if ces08_idnum == 3247
replace ces08_cps_intday = 5 if ces08_idnum == 3248
replace ces08_cps_intday = 30 if ces08_idnum == 3253
replace ces08_cps_intday = 29 if ces08_idnum == 3256
replace ces08_cps_intday = 7 if ces08_idnum == 3257
replace ces08_cps_intday = 2 if ces08_idnum == 3259
replace ces08_cps_intday = 8 if ces08_idnum == 3260
replace ces08_cps_intday = 3 if ces08_idnum == 3266
replace ces08_cps_intday = 8 if ces08_idnum == 3267
replace ces08_cps_intday = 9 if ces08_idnum == 3269
replace ces08_cps_intday = 5 if ces08_idnum == 3272
replace ces08_cps_intday = 2 if ces08_idnum == 3273
replace ces08_cps_intday = 28 if ces08_idnum == 3275
replace ces08_cps_intday = 4 if ces08_idnum == 3276
replace ces08_cps_intday = 28 if ces08_idnum == 3282
replace ces08_cps_intday = 12 if ces08_idnum == 3283
replace ces08_cps_intday = 28 if ces08_idnum == 3290
replace ces08_cps_intday = 10 if ces08_idnum == 3291
replace ces08_cps_intday = 29 if ces08_idnum == 3293
replace ces08_cps_intday = 29 if ces08_idnum == 3294
replace ces08_cps_intday = 8 if ces08_idnum == 3300
replace ces08_cps_intday = 5 if ces08_idnum == 3303
replace ces08_cps_intday = 9 if ces08_idnum == 3315
replace ces08_cps_intday = 4 if ces08_idnum == 3317
replace ces08_cps_intday = 1 if ces08_idnum == 3319
replace ces08_cps_intday = 8 if ces08_idnum == 3324
replace ces08_cps_intday = 1 if ces08_idnum == 3325
replace ces08_cps_intday = 3 if ces08_idnum == 3332
replace ces08_cps_intday = 11 if ces08_idnum == 3334
replace ces08_cps_intday = 30 if ces08_idnum == 3335
replace ces08_cps_intday = 29 if ces08_idnum == 3336
replace ces08_cps_intday = 1 if ces08_idnum == 3340
replace ces08_cps_intday = 29 if ces08_idnum == 3346
replace ces08_cps_intday = 29 if ces08_idnum == 3349
replace ces08_cps_intday = 12 if ces08_idnum == 3350
replace ces08_cps_intday = 2 if ces08_idnum == 3356
replace ces08_cps_intday = 4 if ces08_idnum == 3360
replace ces08_cps_intday = 8 if ces08_idnum == 3361
replace ces08_cps_intday = 2 if ces08_idnum == 3364
replace ces08_cps_intday = 29 if ces08_idnum == 3365
replace ces08_cps_intday = 12 if ces08_idnum == 3366
replace ces08_cps_intday = 2 if ces08_idnum == 3368
replace ces08_cps_intday = 29 if ces08_idnum == 3371
replace ces08_cps_intday = 13 if ces08_idnum == 3374
replace ces08_cps_intday = 1 if ces08_idnum == 3376
replace ces08_cps_intday = 10 if ces08_idnum == 3381
replace ces08_cps_intday = 10 if ces08_idnum == 3387
replace ces08_cps_intday = 29 if ces08_idnum == 3388
replace ces08_cps_intday = 29 if ces08_idnum == 3391
replace ces08_cps_intday = 28 if ces08_idnum == 3392
replace ces08_cps_intday = 28 if ces08_idnum == 3396
replace ces08_cps_intday = 5 if ces08_idnum == 3399
replace ces08_cps_intday = 1 if ces08_idnum == 3410
replace ces08_cps_intday = 29 if ces08_idnum == 3412
replace ces08_cps_intday = 3 if ces08_idnum == 3417
replace ces08_cps_intday = 6 if ces08_idnum == 3423
replace ces08_cps_intday = 28 if ces08_idnum == 3425
replace ces08_cps_intday = 4 if ces08_idnum == 3430
replace ces08_cps_intday = 4 if ces08_idnum == 3433
replace ces08_cps_intday = 8 if ces08_idnum == 3434
replace ces08_cps_intday = 3 if ces08_idnum == 3435
replace ces08_cps_intday = 28 if ces08_idnum == 3436
replace ces08_cps_intday = 28 if ces08_idnum == 3440
replace ces08_cps_intday = 7 if ces08_idnum == 3441
replace ces08_cps_intday = 30 if ces08_idnum == 3442
replace ces08_cps_intday = 1 if ces08_idnum == 3444
replace ces08_cps_intday = 29 if ces08_idnum == 3448
replace ces08_cps_intday = 10 if ces08_idnum == 3449
replace ces08_cps_intday = 9 if ces08_idnum == 3450
replace ces08_cps_intday = 30 if ces08_idnum == 3452
replace ces08_cps_intday = 28 if ces08_idnum == 3458
replace ces08_cps_intday = 2 if ces08_idnum == 3463
replace ces08_cps_intday = 2 if ces08_idnum == 3466
replace ces08_cps_intday = 12 if ces08_idnum == 3467
replace ces08_cps_intday = 28 if ces08_idnum == 3471
replace ces08_cps_intday = 7 if ces08_idnum == 3472
replace ces08_cps_intday = 8 if ces08_idnum == 3473
replace ces08_cps_intday = 9 if ces08_idnum == 3475
replace ces08_cps_intday = 1 if ces08_idnum == 3477
replace ces08_cps_intday = 29 if ces08_idnum == 3479
replace ces08_cps_intday = 9 if ces08_idnum == 3487
replace ces08_cps_intday = 1 if ces08_idnum == 3488
replace ces08_cps_intday = 7 if ces08_idnum == 3492
replace ces08_cps_intday = 3 if ces08_idnum == 3493
replace ces08_cps_intday = 30 if ces08_idnum == 3495
replace ces08_cps_intday = 28 if ces08_idnum == 3498
replace ces08_cps_intday = 11 if ces08_idnum == 3505
replace ces08_cps_intday = 12 if ces08_idnum == 3507
replace ces08_cps_intday = 28 if ces08_idnum == 3508
replace ces08_cps_intday = 28 if ces08_idnum == 3509
replace ces08_cps_intday = 12 if ces08_idnum == 3513
replace ces08_cps_intday = 8 if ces08_idnum == 3515
replace ces08_cps_intday = 29 if ces08_idnum == 3517
replace ces08_cps_intday = 30 if ces08_idnum == 3518
replace ces08_cps_intday = 29 if ces08_idnum == 3519
replace ces08_cps_intday = 30 if ces08_idnum == 3521
replace ces08_cps_intday = 12 if ces08_idnum == 3523
replace ces08_cps_intday = 28 if ces08_idnum == 3524
replace ces08_cps_intday = 30 if ces08_idnum == 3526
replace ces08_cps_intday = 9 if ces08_idnum == 3528
replace ces08_cps_intday = 29 if ces08_idnum == 3530
replace ces08_cps_intday = 7 if ces08_idnum == 3531
replace ces08_cps_intday = 1 if ces08_idnum == 3536
replace ces08_cps_intday = 28 if ces08_idnum == 3547
replace ces08_cps_intday = 8 if ces08_idnum == 3548
replace ces08_cps_intday = 29 if ces08_idnum == 3549
replace ces08_cps_intday = 28 if ces08_idnum == 3551
replace ces08_cps_intday = 8 if ces08_idnum == 3557
replace ces08_cps_intday = 28 if ces08_idnum == 3560
replace ces08_cps_intday = 7 if ces08_idnum == 3563
replace ces08_cps_intday = 29 if ces08_idnum == 3564
replace ces08_cps_intday = 12 if ces08_idnum == 3567
replace ces08_cps_intday = 11 if ces08_idnum == 3568
replace ces08_cps_intday = 30 if ces08_idnum == 3570
replace ces08_cps_intday = 28 if ces08_idnum == 3573
replace ces08_cps_intday = 10 if ces08_idnum == 3574
replace ces08_cps_intday = 11 if ces08_idnum == 3575
replace ces08_cps_intday = 1 if ces08_idnum == 3576
replace ces08_cps_intday = 7 if ces08_idnum == 3582
replace ces08_cps_intday = 6 if ces08_idnum == 3587
replace ces08_cps_intday = 12 if ces08_idnum == 3589
replace ces08_cps_intday = 2 if ces08_idnum == 3590
replace ces08_cps_intday = 11 if ces08_idnum == 3591
replace ces08_cps_intday = 3 if ces08_idnum == 3592
replace ces08_cps_intday = 13 if ces08_idnum == 3604
replace ces08_cps_intday = 29 if ces08_idnum == 3605
replace ces08_cps_intday = 30 if ces08_idnum == 3609
replace ces08_cps_intday = 28 if ces08_idnum == 3610
replace ces08_cps_intday = 30 if ces08_idnum == 3612
replace ces08_cps_intday = 28 if ces08_idnum == 3615
replace ces08_cps_intday = 6 if ces08_idnum == 3616
replace ces08_cps_intday = 10 if ces08_idnum == 3620
replace ces08_cps_intday = 11 if ces08_idnum == 3624
replace ces08_cps_intday = 28 if ces08_idnum == 3628
replace ces08_cps_intday = 28 if ces08_idnum == 3631
replace ces08_cps_intday = 28 if ces08_idnum == 3642
replace ces08_cps_intday = 29 if ces08_idnum == 3645
replace ces08_cps_intday = 13 if ces08_idnum == 3647
replace ces08_cps_intday = 29 if ces08_idnum == 3651
replace ces08_cps_intday = 29 if ces08_idnum == 3652
replace ces08_cps_intday = 9 if ces08_idnum == 3653
replace ces08_cps_intday = 4 if ces08_idnum == 3655
replace ces08_cps_intday = 12 if ces08_idnum == 3656
replace ces08_cps_intday = 12 if ces08_idnum == 3658
replace ces08_cps_intday = 3 if ces08_idnum == 3659
replace ces08_cps_intday = 9 if ces08_idnum == 3664
replace ces08_cps_intday = 10 if ces08_idnum == 3665
replace ces08_cps_intday = 13 if ces08_idnum == 3667
replace ces08_cps_intday = 10 if ces08_idnum == 3668
replace ces08_cps_intday = 11 if ces08_idnum == 3670
replace ces08_cps_intday = 4 if ces08_idnum == 3675
replace ces08_cps_intday = 29 if ces08_idnum == 3676
replace ces08_cps_intday = 4 if ces08_idnum == 3679
replace ces08_cps_intday = 11 if ces08_idnum == 3686
replace ces08_cps_intday = 28 if ces08_idnum == 3689
replace ces08_cps_intday = 6 if ces08_idnum == 3690
replace ces08_cps_intday = 28 if ces08_idnum == 3691
replace ces08_cps_intday = 29 if ces08_idnum == 3692
replace ces08_cps_intday = 9 if ces08_idnum == 3694
replace ces08_cps_intday = 30 if ces08_idnum == 3698
replace ces08_cps_intday = 9 if ces08_idnum == 3701
replace ces08_cps_intday = 3 if ces08_idnum == 3703
replace ces08_cps_intday = 28 if ces08_idnum == 3704
replace ces08_cps_intday = 1 if ces08_idnum == 3707
replace ces08_cps_intday = 3 if ces08_idnum == 3715
replace ces08_cps_intday = 28 if ces08_idnum == 3727
replace ces08_cps_intday = 28 if ces08_idnum == 3729
replace ces08_cps_intday = 28 if ces08_idnum == 3730
replace ces08_cps_intday = 30 if ces08_idnum == 3732
replace ces08_cps_intday = 29 if ces08_idnum == 3733
replace ces08_cps_intday = 8 if ces08_idnum == 3736
replace ces08_cps_intday = 7 if ces08_idnum == 3743
replace ces08_cps_intday = 6 if ces08_idnum == 3744
replace ces08_cps_intday = 28 if ces08_idnum == 3745
replace ces08_cps_intday = 1 if ces08_idnum == 3748
replace ces08_cps_intday = 7 if ces08_idnum == 3755
replace ces08_cps_intday = 1 if ces08_idnum == 3761
replace ces08_cps_intday = 4 if ces08_idnum == 3762
replace ces08_cps_intday = 4 if ces08_idnum == 3764
replace ces08_cps_intday = 29 if ces08_idnum == 3767
replace ces08_cps_intday = 4 if ces08_idnum == 3775
replace ces08_cps_intday = 28 if ces08_idnum == 3777
replace ces08_cps_intday = 29 if ces08_idnum == 3778
replace ces08_cps_intday = 7 if ces08_idnum == 3780
replace ces08_cps_intday = 2 if ces08_idnum == 3787
replace ces08_cps_intday = 28 if ces08_idnum == 3791
replace ces08_cps_intday = 10 if ces08_idnum == 3796
replace ces08_cps_intday = 28 if ces08_idnum == 3799
replace ces08_cps_intday = 1 if ces08_idnum == 3801
replace ces08_cps_intday = 12 if ces08_idnum == 3803
replace ces08_cps_intday = 29 if ces08_idnum == 3806
replace ces08_cps_intday = 5 if ces08_idnum == 3811
replace ces08_cps_intday = 1 if ces08_idnum == 3812
replace ces08_cps_intday = 28 if ces08_idnum == 3815
replace ces08_cps_intday = 1 if ces08_idnum == 3816
replace ces08_cps_intday = 1 if ces08_idnum == 3820
replace ces08_cps_intday = 30 if ces08_idnum == 3827
replace ces08_cps_intday = 4 if ces08_idnum == 3832
replace ces08_cps_intday = 8 if ces08_idnum == 3833
replace ces08_cps_intday = 4 if ces08_idnum == 3835
replace ces08_cps_intday = 30 if ces08_idnum == 3837
replace ces08_cps_intday = 29 if ces08_idnum == 3838
replace ces08_cps_intday = 13 if ces08_idnum == 3841
replace ces08_cps_intday = 30 if ces08_idnum == 3844
replace ces08_cps_intday = 3 if ces08_idnum == 3845
replace ces08_cps_intday = 29 if ces08_idnum == 3846
replace ces08_cps_intday = 28 if ces08_idnum == 3848
replace ces08_cps_intday = 28 if ces08_idnum == 3849
replace ces08_cps_intday = 29 if ces08_idnum == 3850
replace ces08_cps_intday = 29 if ces08_idnum == 3858
replace ces08_cps_intday = 13 if ces08_idnum == 3861
replace ces08_cps_intday = 8 if ces08_idnum == 3864
replace ces08_cps_intday = 8 if ces08_idnum == 3867
replace ces08_cps_intday = 1 if ces08_idnum == 3872
replace ces08_cps_intday = 30 if ces08_idnum == 3873
replace ces08_cps_intday = 29 if ces08_idnum == 3874
replace ces08_cps_intday = 6 if ces08_idnum == 3875
replace ces08_cps_intday = 30 if ces08_idnum == 3878
replace ces08_cps_intday = 8 if ces08_idnum == 3879
replace ces08_cps_intday = 6 if ces08_idnum == 3881
replace ces08_cps_intday = 29 if ces08_idnum == 3882
replace ces08_cps_intday = 1 if ces08_idnum == 3885
replace ces08_cps_intday = 5 if ces08_idnum == 3889
replace ces08_cps_intday = 28 if ces08_idnum == 3890
replace ces08_cps_intday = 8 if ces08_idnum == 3893
replace ces08_cps_intday = 8 if ces08_idnum == 3895
replace ces08_cps_intday = 8 if ces08_idnum == 3897
replace ces08_cps_intday = 28 if ces08_idnum == 3899
replace ces08_cps_intday = 29 if ces08_idnum == 3902
replace ces08_cps_intday = 28 if ces08_idnum == 3906
replace ces08_cps_intday = 13 if ces08_idnum == 3908
replace ces08_cps_intday = 1 if ces08_idnum == 3910
replace ces08_cps_intday = 9 if ces08_idnum == 3911
replace ces08_cps_intday = 13 if ces08_idnum == 3912
replace ces08_cps_intday = 28 if ces08_idnum == 3913
replace ces08_cps_intday = 30 if ces08_idnum == 3919
replace ces08_cps_intday = 1 if ces08_idnum == 3924
replace ces08_cps_intday = 9 if ces08_idnum == 3927
replace ces08_cps_intday = 1 if ces08_idnum == 3931
replace ces08_cps_intday = 8 if ces08_idnum == 3936
replace ces08_cps_intday = 3 if ces08_idnum == 3938
replace ces08_cps_intday = 2 if ces08_idnum == 3939
replace ces08_cps_intday = 28 if ces08_idnum == 3942
replace ces08_cps_intday = 30 if ces08_idnum == 3945
replace ces08_cps_intday = 30 if ces08_idnum == 3949
replace ces08_cps_intday = 6 if ces08_idnum == 3955
replace ces08_cps_intday = 4 if ces08_idnum == 3956
replace ces08_cps_intday = 8 if ces08_idnum == 3959
replace ces08_cps_intday = 28 if ces08_idnum == 3960
replace ces08_cps_intday = 6 if ces08_idnum == 3961
replace ces08_cps_intday = 7 if ces08_idnum == 3965
replace ces08_cps_intday = 8 if ces08_idnum == 3972
replace ces08_cps_intday = 30 if ces08_idnum == 3977
replace ces08_cps_intday = 30 if ces08_idnum == 3979
replace ces08_cps_intday = 1 if ces08_idnum == 3980
replace ces08_cps_intday = 10 if ces08_idnum == 3982
replace ces08_cps_intday = 13 if ces08_idnum == 3986
replace ces08_cps_intday = 5 if ces08_idnum == 3991
replace ces08_cps_intday = 7 if ces08_idnum == 3996
replace ces08_cps_intday = 13 if ces08_idnum == 3999
replace ces08_cps_intday = 8 if ces08_idnum == 4002
replace ces08_cps_intday = 9 if ces08_idnum == 4003
replace ces08_cps_intday = 9 if ces08_idnum == 4009
replace ces08_cps_intday = 12 if ces08_idnum == 4012
replace ces08_cps_intday = 13 if ces08_idnum == 4017
replace ces08_cps_intday = 6 if ces08_idnum == 4020
replace ces08_cps_intday = 6 if ces08_idnum == 4025
replace ces08_cps_intday = 9 if ces08_idnum == 4027
replace ces08_cps_intday = 13 if ces08_idnum == 4028
replace ces08_cps_intday = 6 if ces08_idnum == 4032
replace ces08_cps_intday = 13 if ces08_idnum == 4045
replace ces08_cps_intday = 11 if ces08_idnum == 4053
replace ces08_cps_intday = 6 if ces08_idnum == 4055
replace ces08_cps_intday = 8 if ces08_idnum == 4058
replace ces08_cps_intday = 13 if ces08_idnum == 4065
replace ces08_cps_intday = 8 if ces08_idnum == 4066
replace ces08_cps_intday = 9 if ces08_idnum == 4067
replace ces08_cps_intday = 12 if ces08_idnum == 4071
replace ces08_cps_intday = 8 if ces08_idnum == 4072
replace ces08_cps_intday = 9 if ces08_idnum == 4073
replace ces08_cps_intday = 8 if ces08_idnum == 4074
replace ces08_cps_intday = 12 if ces08_idnum == 4075
replace ces08_cps_intday = 6 if ces08_idnum == 4086
replace ces08_cps_intday = 10 if ces08_idnum == 4090
replace ces08_cps_intday = 13 if ces08_idnum == 4099
replace ces08_cps_intday = 9 if ces08_idnum == 4102
replace ces08_cps_intday = 12 if ces08_idnum == 4103
replace ces08_cps_intday = 6 if ces08_idnum == 4107
replace ces08_cps_intday = 12 if ces08_idnum == 4108
replace ces08_cps_intday = 6 if ces08_idnum == 4110
replace ces08_cps_intday = 6 if ces08_idnum == 4120
replace ces08_cps_intday = 12 if ces08_idnum == 4126
replace ces08_cps_intday = 8 if ces08_idnum == 4131
replace ces08_cps_intday = 10 if ces08_idnum == 4132
replace ces08_cps_intday = 6 if ces08_idnum == 4135
replace ces08_cps_intday = 8 if ces08_idnum == 4137
replace ces08_cps_intday = 7 if ces08_idnum == 4138
replace ces08_cps_intday = 6 if ces08_idnum == 4145
replace ces08_cps_intday = 6 if ces08_idnum == 4151
replace ces08_cps_intday = 7 if ces08_idnum == 4152
replace ces08_cps_intday = 13 if ces08_idnum == 4153
replace ces08_cps_intday = 6 if ces08_idnum == 4158
replace ces08_cps_intday = 8 if ces08_idnum == 4162
replace ces08_cps_intday = 6 if ces08_idnum == 4165
replace ces08_cps_intday = 6 if ces08_idnum == 4167
replace ces08_cps_intday = 10 if ces08_idnum == 4171
replace ces08_cps_intday = 8 if ces08_idnum == 4176
replace ces08_cps_intday = 8 if ces08_idnum == 4181
replace ces08_cps_intday = 8 if ces08_idnum == 4187
replace ces08_cps_intday = 6 if ces08_idnum == 4188
replace ces08_cps_intday = 12 if ces08_idnum == 4193
replace ces08_cps_intday = 13 if ces08_idnum == 4196
replace ces08_cps_intday = 6 if ces08_idnum == 4198
replace ces08_cps_intday = 6 if ces08_idnum == 4200
replace ces08_cps_intday = 9 if ces08_idnum == 4205
replace ces08_cps_intday = 6 if ces08_idnum == 4208
replace ces08_cps_intday = 13 if ces08_idnum == 4209
replace ces08_cps_intday = 8 if ces08_idnum == 4212
replace ces08_cps_intday = 6 if ces08_idnum == 4213
replace ces08_cps_intday = 9 if ces08_idnum == 4215
replace ces08_cps_intday = 7 if ces08_idnum == 4220
replace ces08_cps_intday = 7 if ces08_idnum == 4221
replace ces08_cps_intday = 8 if ces08_idnum == 4225
replace ces08_cps_intday = 8 if ces08_idnum == 4230
replace ces08_cps_intday = 8 if ces08_idnum == 4235
replace ces08_cps_intday = 6 if ces08_idnum == 4241
replace ces08_cps_intday = 7 if ces08_idnum == 4242
replace ces08_cps_intday = 10 if ces08_idnum == 4258
replace ces08_cps_intday = 10 if ces08_idnum == 4262
replace ces08_cps_intday = 13 if ces08_idnum == 4265
replace ces08_cps_intday = 9 if ces08_idnum == 4267
replace ces08_cps_intday = 12 if ces08_idnum == 4269
replace ces08_cps_intday = 7 if ces08_idnum == 4271
replace ces08_cps_intday = 7 if ces08_idnum == 4276
replace ces08_cps_intday = 7 if ces08_idnum == 4277
replace ces08_cps_intday = 13 if ces08_idnum == 4278
replace ces08_cps_intday = 7 if ces08_idnum == 4289
replace ces08_cps_intday = 7 if ces08_idnum == 4291
replace ces08_cps_intday = 9 if ces08_idnum == 4292
replace ces08_cps_intday = 7 if ces08_idnum == 4294
replace ces08_cps_intday = 8 if ces08_idnum == 4295
replace ces08_cps_intday = 13 if ces08_idnum == 4298
replace ces08_cps_intday = 8 if ces08_idnum == 4300
replace ces08_cps_intday = 11 if ces08_idnum == 4302
replace ces08_cps_intday = 11 if ces08_idnum == 4303
replace ces08_cps_intday = 7 if ces08_idnum == 4308
replace ces08_cps_intday = 10 if ces08_idnum == 4309
replace ces08_cps_intday = 7 if ces08_idnum == 4312
replace ces08_cps_intday = 7 if ces08_idnum == 4321
replace ces08_cps_intday = 8 if ces08_idnum == 4323
replace ces08_cps_intday = 10 if ces08_idnum == 4325
replace ces08_cps_intday = 7 if ces08_idnum == 4329
replace ces08_cps_intday = 7 if ces08_idnum == 4331
replace ces08_cps_intday = 7 if ces08_idnum == 4333
replace ces08_cps_intday = 9 if ces08_idnum == 4335
replace ces08_cps_intday = 12 if ces08_idnum == 4339
replace ces08_cps_intday = 13 if ces08_idnum == 4361
replace ces08_cps_intday = 8 if ces08_idnum == 4367
replace ces08_cps_intday = 13 if ces08_idnum == 4368
replace ces08_cps_intday = 8 if ces08_idnum == 4369
replace ces08_cps_intday = 9 if ces08_idnum == 4376
replace ces08_cps_intday = 9 if ces08_idnum == 4377
replace ces08_cps_intday = 13 if ces08_idnum == 4387
replace ces08_cps_intday = 9 if ces08_idnum == 4388
replace ces08_cps_intday = 11 if ces08_idnum == 4390
replace ces08_cps_intday = 12 if ces08_idnum == 4393
replace ces08_cps_intday = 7 if ces08_idnum == 4400
replace ces08_cps_intday = 7 if ces08_idnum == 4401
replace ces08_cps_intday = 7 if ces08_idnum == 4404
replace ces08_cps_intday = 12 if ces08_idnum == 4410
replace ces08_cps_intday = 7 if ces08_idnum == 4417
replace ces08_cps_intday = 7 if ces08_idnum == 4418
replace ces08_cps_intday = 7 if ces08_idnum == 4420
replace ces08_cps_intday = 11 if ces08_idnum == 4422
replace ces08_cps_intday = 11 if ces08_idnum == 4427
replace ces08_cps_intday = 12 if ces08_idnum == 4438
replace ces08_cps_intday = 7 if ces08_idnum == 4441
replace ces08_cps_intday = 9 if ces08_idnum == 4444
replace ces08_cps_intday = 10 if ces08_idnum == 4448
replace ces08_cps_intday = 8 if ces08_idnum == 4452
replace ces08_cps_intday = 8 if ces08_idnum == 4456
replace ces08_cps_intday = 11 if ces08_idnum == 4460
replace ces08_cps_intday = 7 if ces08_idnum == 4461
replace ces08_cps_intday = 10 if ces08_idnum == 4462
replace ces08_cps_intday = 10 if ces08_idnum == 4465
replace ces08_cps_intday = 8 if ces08_idnum == 4467
replace ces08_cps_intday = 9 if ces08_idnum == 4469
replace ces08_cps_intday = 7 if ces08_idnum == 4471
replace ces08_cps_intday = 13 if ces08_idnum == 4472
replace ces08_cps_intday = 12 if ces08_idnum == 4474
replace ces08_cps_intday = 7 if ces08_idnum == 4475
replace ces08_cps_intday = 7 if ces08_idnum == 4478
replace ces08_cps_intday = 10 if ces08_idnum == 4479
replace ces08_cps_intday = 13 if ces08_idnum == 4488
replace ces08_cps_intday = 7 if ces08_idnum == 4492
replace ces08_cps_intday = 8 if ces08_idnum == 4493
replace ces08_cps_intday = 12 if ces08_idnum == 4495
replace ces08_cps_intday = 7 if ces08_idnum == 4496
replace ces08_cps_intday = 11 if ces08_idnum == 4507
replace ces08_cps_intday = 9 if ces08_idnum == 4508
replace ces08_cps_intday = 10 if ces08_idnum == 4513
replace ces08_cps_intday = 9 if ces08_idnum == 4517
replace ces08_cps_intday = 12 if ces08_idnum == 4518
replace ces08_cps_intday = 11 if ces08_idnum == 4521
replace ces08_cps_intday = 9 if ces08_idnum == 4522
replace ces08_cps_intday = 13 if ces08_idnum == 4524
replace ces08_cps_intday = 10 if ces08_idnum == 4526
replace ces08_cps_intday = 9 if ces08_idnum == 4529
replace ces08_cps_intday = 10 if ces08_idnum == 4530
replace ces08_cps_intday = 10 if ces08_idnum == 4532
replace ces08_cps_intday = 10 if ces08_idnum == 4542
replace ces08_cps_intday = 13 if ces08_idnum == 4545
replace ces08_cps_intday = 9 if ces08_idnum == 4561
replace ces08_cps_intday = 11 if ces08_idnum == 4568
replace ces08_cps_intday = 10 if ces08_idnum == 4569
replace ces08_cps_intday = 12 if ces08_idnum == 4570
replace ces08_cps_intday = 11 if ces08_idnum == 4573
replace ces08_cps_intday = 9 if ces08_idnum == 4577
replace ces08_cps_intday = 12 if ces08_idnum == 4578
replace ces08_cps_intday = 9 if ces08_idnum == 4581
replace ces08_cps_intday = 9 if ces08_idnum == 4584
replace ces08_cps_intday = 9 if ces08_idnum == 4587
replace ces08_cps_intday = 9 if ces08_idnum == 4590
replace ces08_cps_intday = 9 if ces08_idnum == 4597
replace ces08_cps_intday = 6 if ces08_idnum == 7001
replace ces08_cps_intday = 28 if ces08_idnum == 7002
replace ces08_cps_intday = 26 if ces08_idnum == 7015
replace ces08_cps_intday = 28 if ces08_idnum == 7022
replace ces08_cps_intday = 29 if ces08_idnum == 7023
replace ces08_cps_intday = 29 if ces08_idnum == 7025
replace ces08_cps_intday = 9 if ces08_idnum == 7029
replace ces08_cps_intday = 29 if ces08_idnum == 7034
replace ces08_cps_intday = 27 if ces08_idnum == 7036
replace ces08_cps_intday = 27 if ces08_idnum == 7038
replace ces08_cps_intday = 8 if ces08_idnum == 7040
replace ces08_cps_intday = 11 if ces08_idnum == 7046
replace ces08_cps_intday = 28 if ces08_idnum == 7049
replace ces08_cps_intday = 4 if ces08_idnum == 7052
replace ces08_cps_intday = 9 if ces08_idnum == 7061
replace ces08_cps_intday = 29 if ces08_idnum == 7069
replace ces08_cps_intday = 7 if ces08_idnum == 7070
replace ces08_cps_intday = 27 if ces08_idnum == 7076
replace ces08_cps_intday = 26 if ces08_idnum == 7085
replace ces08_cps_intday = 28 if ces08_idnum == 7093
replace ces08_cps_intday = 28 if ces08_idnum == 7105
replace ces08_cps_intday = 12 if ces08_idnum == 7107
replace ces08_cps_intday = 7 if ces08_idnum == 7109
replace ces08_cps_intday = 30 if ces08_idnum == 7110
replace ces08_cps_intday = 5 if ces08_idnum == 7114
replace ces08_cps_intday = 28 if ces08_idnum == 7123
replace ces08_cps_intday = 27 if ces08_idnum == 7133
replace ces08_cps_intday = 6 if ces08_idnum == 7135
replace ces08_cps_intday = 27 if ces08_idnum == 7139
replace ces08_cps_intday = 27 if ces08_idnum == 7150
replace ces08_cps_intday = 29 if ces08_idnum == 7151
replace ces08_cps_intday = 27 if ces08_idnum == 7153
replace ces08_cps_intday = 6 if ces08_idnum == 7155
replace ces08_cps_intday = 28 if ces08_idnum == 7162
replace ces08_cps_intday = 13 if ces08_idnum == 7165
replace ces08_cps_intday = 27 if ces08_idnum == 7168
replace ces08_cps_intday = 13 if ces08_idnum == 7170
replace ces08_cps_intday = 7 if ces08_idnum == 7176
replace ces08_cps_intday = 2 if ces08_idnum == 7179
replace ces08_cps_intday = 29 if ces08_idnum == 7182
replace ces08_cps_intday = 30 if ces08_idnum == 7187
replace ces08_cps_intday = 27 if ces08_idnum == 7190
replace ces08_cps_intday = 27 if ces08_idnum == 7192
replace ces08_cps_intday = 7 if ces08_idnum == 7201
replace ces08_cps_intday = 29 if ces08_idnum == 7202
replace ces08_cps_intday = 8 if ces08_idnum == 7203
replace ces08_cps_intday = 27 if ces08_idnum == 7206
replace ces08_cps_intday = 12 if ces08_idnum == 7212
replace ces08_cps_intday = 11 if ces08_idnum == 7214
replace ces08_cps_intday = 29 if ces08_idnum == 7215
replace ces08_cps_intday = 9 if ces08_idnum == 7219
replace ces08_cps_intday = 5 if ces08_idnum == 7220
replace ces08_cps_intday = 8 if ces08_idnum == 7227
replace ces08_cps_intday = 9 if ces08_idnum == 7239
replace ces08_cps_intday = 10 if ces08_idnum == 7257
replace ces08_cps_intday = 29 if ces08_idnum == 7264
replace ces08_cps_intday = 7 if ces08_idnum == 7265
replace ces08_cps_intday = 1 if ces08_idnum == 7271
replace ces08_cps_intday = 27 if ces08_idnum == 7276
replace ces08_cps_intday = 27 if ces08_idnum == 7277
replace ces08_cps_intday = 6 if ces08_idnum == 7282
replace ces08_cps_intday = 13 if ces08_idnum == 7285
replace ces08_cps_intday = 30 if ces08_idnum == 7286
replace ces08_cps_intday = 28 if ces08_idnum == 7287
replace ces08_cps_intday = 11 if ces08_idnum == 7290
replace ces08_cps_intday = 30 if ces08_idnum == 7292
replace ces08_cps_intday = 27 if ces08_idnum == 7295
replace ces08_cps_intday = 30 if ces08_idnum == 7296
replace ces08_cps_intday = 1 if ces08_idnum == 7297
replace ces08_cps_intday = 8 if ces08_idnum == 7298
replace ces08_cps_intday = 28 if ces08_idnum == 7309
replace ces08_cps_intday = 2 if ces08_idnum == 7312
replace ces08_cps_intday = 2 if ces08_idnum == 7313
replace ces08_cps_intday = 10 if ces08_idnum == 7314
replace ces08_cps_intday = 30 if ces08_idnum == 7325
replace ces08_cps_intday = 27 if ces08_idnum == 7335
replace ces08_cps_intday = 27 if ces08_idnum == 7336
replace ces08_cps_intday = 9 if ces08_idnum == 7337
replace ces08_cps_intday = 28 if ces08_idnum == 7338
replace ces08_cps_intday = 29 if ces08_idnum == 7339
replace ces08_cps_intday = 28 if ces08_idnum == 7344
replace ces08_cps_intday = 7 if ces08_idnum == 7345
replace ces08_cps_intday = 1 if ces08_idnum == 7348
replace ces08_cps_intday = 4 if ces08_idnum == 7349
replace ces08_cps_intday = 27 if ces08_idnum == 7353
replace ces08_cps_intday = 28 if ces08_idnum == 7354
replace ces08_cps_intday = 27 if ces08_idnum == 7359
replace ces08_cps_intday = 2 if ces08_idnum == 7363
replace ces08_cps_intday = 11 if ces08_idnum == 7371
replace ces08_cps_intday = 27 if ces08_idnum == 7372
replace ces08_cps_intday = 30 if ces08_idnum == 7376
replace ces08_cps_intday = 27 if ces08_idnum == 7386
replace ces08_cps_intday = 28 if ces08_idnum == 7387
replace ces08_cps_intday = 28 if ces08_idnum == 7388
replace ces08_cps_intday = 30 if ces08_idnum == 7394
replace ces08_cps_intday = 28 if ces08_idnum == 7397
replace ces08_cps_intday = 29 if ces08_idnum == 7399
replace ces08_cps_intday = 9 if ces08_idnum == 7412
replace ces08_cps_intday = 30 if ces08_idnum == 7413
replace ces08_cps_intday = 30 if ces08_idnum == 7416
replace ces08_cps_intday = 5 if ces08_idnum == 7417
replace ces08_cps_intday = 30 if ces08_idnum == 7420
replace ces08_cps_intday = 10 if ces08_idnum == 7425
replace ces08_cps_intday = 7 if ces08_idnum == 7428
replace ces08_cps_intday = 5 if ces08_idnum == 7438
replace ces08_cps_intday = 27 if ces08_idnum == 7440
replace ces08_cps_intday = 13 if ces08_idnum == 7447
replace ces08_cps_intday = 27 if ces08_idnum == 7448
replace ces08_cps_intday = 1 if ces08_idnum == 7451
replace ces08_cps_intday = 2 if ces08_idnum == 7453
replace ces08_cps_intday = 5 if ces08_idnum == 7454
replace ces08_cps_intday = 9 if ces08_idnum == 7455
replace ces08_cps_intday = 28 if ces08_idnum == 7456
replace ces08_cps_intday = 27 if ces08_idnum == 7458
replace ces08_cps_intday = 1 if ces08_idnum == 7465
replace ces08_cps_intday = 27 if ces08_idnum == 7468
replace ces08_cps_intday = 27 if ces08_idnum == 7469
replace ces08_cps_intday = 27 if ces08_idnum == 7472
replace ces08_cps_intday = 9 if ces08_idnum == 7479
replace ces08_cps_intday = 3 if ces08_idnum == 7487
replace ces08_cps_intday = 27 if ces08_idnum == 7490
replace ces08_cps_intday = 2 if ces08_idnum == 7493
replace ces08_cps_intday = 30 if ces08_idnum == 7499
replace ces08_cps_intday = 27 if ces08_idnum == 7502
replace ces08_cps_intday = 28 if ces08_idnum == 7503
replace ces08_cps_intday = 27 if ces08_idnum == 7506
replace ces08_cps_intday = 5 if ces08_idnum == 7509
replace ces08_cps_intday = 8 if ces08_idnum == 7510
replace ces08_cps_intday = 9 if ces08_idnum == 7525
replace ces08_cps_intday = 6 if ces08_idnum == 7526
replace ces08_cps_intday = 1 if ces08_idnum == 7527
replace ces08_cps_intday = 12 if ces08_idnum == 7528
replace ces08_cps_intday = 11 if ces08_idnum == 7531
replace ces08_cps_intday = 28 if ces08_idnum == 7534
replace ces08_cps_intday = 1 if ces08_idnum == 7536
replace ces08_cps_intday = 1 if ces08_idnum == 7538
replace ces08_cps_intday = 27 if ces08_idnum == 7542
replace ces08_cps_intday = 11 if ces08_idnum == 7544
replace ces08_cps_intday = 27 if ces08_idnum == 7545
replace ces08_cps_intday = 30 if ces08_idnum == 7546
replace ces08_cps_intday = 6 if ces08_idnum == 7559
replace ces08_cps_intday = 27 if ces08_idnum == 7560
replace ces08_cps_intday = 28 if ces08_idnum == 7562
replace ces08_cps_intday = 13 if ces08_idnum == 7564
replace ces08_cps_intday = 30 if ces08_idnum == 7568
replace ces08_cps_intday = 27 if ces08_idnum == 7570
replace ces08_cps_intday = 1 if ces08_idnum == 7571
replace ces08_cps_intday = 27 if ces08_idnum == 7572
replace ces08_cps_intday = 2 if ces08_idnum == 7579
replace ces08_cps_intday = 28 if ces08_idnum == 7582
replace ces08_cps_intday = 9 if ces08_idnum == 7584
replace ces08_cps_intday = 2 if ces08_idnum == 7586
replace ces08_cps_intday = 27 if ces08_idnum == 7587
replace ces08_cps_intday = 11 if ces08_idnum == 7598
replace ces08_cps_intday = 5 if ces08_idnum == 7600
replace ces08_cps_intday = 29 if ces08_idnum == 7602
replace ces08_cps_intday = 2 if ces08_idnum == 7608
replace ces08_cps_intday = 27 if ces08_idnum == 7611
replace ces08_cps_intday = 8 if ces08_idnum == 7616
replace ces08_cps_intday = 27 if ces08_idnum == 7619
replace ces08_cps_intday = 11 if ces08_idnum == 7620
replace ces08_cps_intday = 27 if ces08_idnum == 7621
replace ces08_cps_intday = 29 if ces08_idnum == 7622
replace ces08_cps_intday = 7 if ces08_idnum == 7623
replace ces08_cps_intday = 9 if ces08_idnum == 7624
replace ces08_cps_intday = 8 if ces08_idnum == 7628
replace ces08_cps_intday = 27 if ces08_idnum == 7629
replace ces08_cps_intday = 30 if ces08_idnum == 7631
replace ces08_cps_intday = 29 if ces08_idnum == 7633
replace ces08_cps_intday = 28 if ces08_idnum == 7638
replace ces08_cps_intday = 28 if ces08_idnum == 7647
replace ces08_cps_intday = 4 if ces08_idnum == 7648
replace ces08_cps_intday = 29 if ces08_idnum == 7649
replace ces08_cps_intday = 30 if ces08_idnum == 7650
replace ces08_cps_intday = 1 if ces08_idnum == 7652
replace ces08_cps_intday = 1 if ces08_idnum == 7653
replace ces08_cps_intday = 5 if ces08_idnum == 7655
replace ces08_cps_intday = 1 if ces08_idnum == 7658
replace ces08_cps_intday = 13 if ces08_idnum == 7660
replace ces08_cps_intday = 27 if ces08_idnum == 7663
replace ces08_cps_intday = 28 if ces08_idnum == 7667
replace ces08_cps_intday = 30 if ces08_idnum == 7681
replace ces08_cps_intday = 28 if ces08_idnum == 7682
replace ces08_cps_intday = 12 if ces08_idnum == 7683
replace ces08_cps_intday = 28 if ces08_idnum == 7689
replace ces08_cps_intday = 9 if ces08_idnum == 7690
replace ces08_cps_intday = 29 if ces08_idnum == 7693
replace ces08_cps_intday = 27 if ces08_idnum == 7695
replace ces08_cps_intday = 7 if ces08_idnum == 7697
replace ces08_cps_intday = 7 if ces08_idnum == 7698
replace ces08_cps_intday = 9 if ces08_idnum == 7704
replace ces08_cps_intday = 7 if ces08_idnum == 7709
replace ces08_cps_intday = 3 if ces08_idnum == 7710
replace ces08_cps_intday = 30 if ces08_idnum == 7711
replace ces08_cps_intday = 9 if ces08_idnum == 7715
replace ces08_cps_intday = 28 if ces08_idnum == 7718
replace ces08_cps_intday = 9 if ces08_idnum == 7722
replace ces08_cps_intday = 29 if ces08_idnum == 7723
replace ces08_cps_intday = 28 if ces08_idnum == 7726
replace ces08_cps_intday = 29 if ces08_idnum == 7727
replace ces08_cps_intday = 7 if ces08_idnum == 7728
replace ces08_cps_intday = 8 if ces08_idnum == 7732
replace ces08_cps_intday = 8 if ces08_idnum == 7734
replace ces08_cps_intday = 5 if ces08_idnum == 7743
replace ces08_cps_intday = 27 if ces08_idnum == 7745
replace ces08_cps_intday = 1 if ces08_idnum == 7748
replace ces08_cps_intday = 28 if ces08_idnum == 7751
replace ces08_cps_intday = 28 if ces08_idnum == 7752
replace ces08_cps_intday = 5 if ces08_idnum == 7756
replace ces08_cps_intday = 27 if ces08_idnum == 7759
replace ces08_cps_intday = 7 if ces08_idnum == 7762
replace ces08_cps_intday = 28 if ces08_idnum == 7765
replace ces08_cps_intday = 5 if ces08_idnum == 7768
replace ces08_cps_intday = 7 if ces08_idnum == 7769
replace ces08_cps_intday = 13 if ces08_idnum == 7770
replace ces08_cps_intday = 6 if ces08_idnum == 7776
replace ces08_cps_intday = 29 if ces08_idnum == 7778
replace ces08_cps_intday = 4 if ces08_idnum == 7781
replace ces08_cps_intday = 30 if ces08_idnum == 7790
replace ces08_cps_intday = 9 if ces08_idnum == 7792
replace ces08_cps_intday = 28 if ces08_idnum == 7793
replace ces08_cps_intday = 29 if ces08_idnum == 7796
replace ces08_cps_intday = 27 if ces08_idnum == 7799
replace ces08_cps_intday = 30 if ces08_idnum == 7804
replace ces08_cps_intday = 30 if ces08_idnum == 7809
replace ces08_cps_intday = 28 if ces08_idnum == 7811
replace ces08_cps_intday = 30 if ces08_idnum == 7814
replace ces08_cps_intday = 28 if ces08_idnum == 7816
replace ces08_cps_intday = 2 if ces08_idnum == 7818
replace ces08_cps_intday = 6 if ces08_idnum == 7820
replace ces08_cps_intday = 5 if ces08_idnum == 7822
replace ces08_cps_intday = 8 if ces08_idnum == 7824
replace ces08_cps_intday = 7 if ces08_idnum == 7826
replace ces08_cps_intday = 5 if ces08_idnum == 7829
replace ces08_cps_intday = 5 if ces08_idnum == 7832
replace ces08_cps_intday = 29 if ces08_idnum == 7836
replace ces08_cps_intday = 27 if ces08_idnum == 7839
replace ces08_cps_intday = 4 if ces08_idnum == 7840
replace ces08_cps_intday = 27 if ces08_idnum == 7848
replace ces08_cps_intday = 10 if ces08_idnum == 7851
replace ces08_cps_intday = 8 if ces08_idnum == 7852
replace ces08_cps_intday = 30 if ces08_idnum == 7853
replace ces08_cps_intday = 7 if ces08_idnum == 7857
replace ces08_cps_intday = 28 if ces08_idnum == 7858
replace ces08_cps_intday = 27 if ces08_idnum == 7861
replace ces08_cps_intday = 9 if ces08_idnum == 7863
replace ces08_cps_intday = 5 if ces08_idnum == 7874
replace ces08_cps_intday = 6 if ces08_idnum == 7887
replace ces08_cps_intday = 6 if ces08_idnum == 7893
replace ces08_cps_intday = 27 if ces08_idnum == 7898
replace ces08_cps_intday = 28 if ces08_idnum == 7899
replace ces08_cps_intday = 30 if ces08_idnum == 7901
replace ces08_cps_intday = 9 if ces08_idnum == 7905
replace ces08_cps_intday = 27 if ces08_idnum == 7907
replace ces08_cps_intday = 6 if ces08_idnum == 7909
replace ces08_cps_intday = 27 if ces08_idnum == 7913
replace ces08_cps_intday = 6 if ces08_idnum == 7916
replace ces08_cps_intday = 27 if ces08_idnum == 7920
replace ces08_cps_intday = 30 if ces08_idnum == 7921
replace ces08_cps_intday = 3 if ces08_idnum == 7926
replace ces08_cps_intday = 27 if ces08_idnum == 7937
replace ces08_cps_intday = 8 if ces08_idnum == 7939
replace ces08_cps_intday = 12 if ces08_idnum == 7940
replace ces08_cps_intday = 4 if ces08_idnum == 7941
replace ces08_cps_intday = 30 if ces08_idnum == 7943
replace ces08_cps_intday = 30 if ces08_idnum == 7944
replace ces08_cps_intday = 30 if ces08_idnum == 7947
replace ces08_cps_intday = 7 if ces08_idnum == 7949
replace ces08_cps_intday = 27 if ces08_idnum == 7951
replace ces08_cps_intday = 28 if ces08_idnum == 7954
replace ces08_cps_intday = 6 if ces08_idnum == 7956
replace ces08_cps_intday = 6 if ces08_idnum == 7958
replace ces08_cps_intday = 28 if ces08_idnum == 7967
replace ces08_cps_intday = 6 if ces08_idnum == 7969
replace ces08_cps_intday = 2 if ces08_idnum == 7971
replace ces08_cps_intday = 7 if ces08_idnum == 7973
replace ces08_cps_intday = 3 if ces08_idnum == 7977
replace ces08_cps_intday = 12 if ces08_idnum == 7979
replace ces08_cps_intday = 2 if ces08_idnum == 7980
replace ces08_cps_intday = 1 if ces08_idnum == 7981
replace ces08_cps_intday = 30 if ces08_idnum == 7982
replace ces08_cps_intday = 11 if ces08_idnum == 7985
replace ces08_cps_intday = 5 if ces08_idnum == 7996
replace ces08_cps_intday = 30 if ces08_idnum == 7997
replace ces08_cps_intday = 8 if ces08_idnum == 7998
replace ces08_cps_intday = 4 if ces08_idnum == 8000
replace ces08_cps_intday = 27 if ces08_idnum == 8012
replace ces08_cps_intday = 27 if ces08_idnum == 8015
replace ces08_cps_intday = 8 if ces08_idnum == 8020
replace ces08_cps_intday = 11 if ces08_idnum == 8029
replace ces08_cps_intday = 5 if ces08_idnum == 8037
replace ces08_cps_intday = 4 if ces08_idnum == 8038
replace ces08_cps_intday = 4 if ces08_idnum == 8039
replace ces08_cps_intday = 9 if ces08_idnum == 8044
replace ces08_cps_intday = 28 if ces08_idnum == 8046
replace ces08_cps_intday = 10 if ces08_idnum == 8049
replace ces08_cps_intday = 1 if ces08_idnum == 8052
replace ces08_cps_intday = 12 if ces08_idnum == 8057
replace ces08_cps_intday = 13 if ces08_idnum == 8058
replace ces08_cps_intday = 28 if ces08_idnum == 8061
replace ces08_cps_intday = 28 if ces08_idnum == 8066
replace ces08_cps_intday = 2 if ces08_idnum == 8073
replace ces08_cps_intday = 29 if ces08_idnum == 8078
replace ces08_cps_intday = 6 if ces08_idnum == 8082
replace ces08_cps_intday = 8 if ces08_idnum == 8089
replace ces08_cps_intday = 28 if ces08_idnum == 8092
replace ces08_cps_intday = 2 if ces08_idnum == 8094
replace ces08_cps_intday = 30 if ces08_idnum == 8102
replace ces08_cps_intday = 28 if ces08_idnum == 8105
replace ces08_cps_intday = 7 if ces08_idnum == 8110
replace ces08_cps_intday = 1 if ces08_idnum == 8112
replace ces08_cps_intday = 2 if ces08_idnum == 8114
replace ces08_cps_intday = 3 if ces08_idnum == 8118
replace ces08_cps_intday = 1 if ces08_idnum == 8119
replace ces08_cps_intday = 6 if ces08_idnum == 8121
replace ces08_cps_intday = 28 if ces08_idnum == 8153
replace ces08_cps_intday = 11 if ces08_idnum == 8163
replace ces08_cps_intday = 30 if ces08_idnum == 8166
replace ces08_cps_intday = 28 if ces08_idnum == 8167
replace ces08_cps_intday = 28 if ces08_idnum == 8169
replace ces08_cps_intday = 28 if ces08_idnum == 8171
replace ces08_cps_intday = 5 if ces08_idnum == 8176
replace ces08_cps_intday = 28 if ces08_idnum == 8177
replace ces08_cps_intday = 6 if ces08_idnum == 8179
replace ces08_cps_intday = 2 if ces08_idnum == 8183
replace ces08_cps_intday = 28 if ces08_idnum == 8194
replace ces08_cps_intday = 2 if ces08_idnum == 8199
replace ces08_cps_intday = 28 if ces08_idnum == 8201
replace ces08_cps_intday = 4 if ces08_idnum == 8203
replace ces08_cps_intday = 8 if ces08_idnum == 8207
replace ces08_cps_intday = 29 if ces08_idnum == 8209
replace ces08_cps_intday = 28 if ces08_idnum == 8212
replace ces08_cps_intday = 7 if ces08_idnum == 8214
replace ces08_cps_intday = 7 if ces08_idnum == 8217
replace ces08_cps_intday = 1 if ces08_idnum == 8222
replace ces08_cps_intday = 28 if ces08_idnum == 8223
replace ces08_cps_intday = 28 if ces08_idnum == 8233
replace ces08_cps_intday = 2 if ces08_idnum == 8234
replace ces08_cps_intday = 28 if ces08_idnum == 8236
replace ces08_cps_intday = 2 if ces08_idnum == 8239
replace ces08_cps_intday = 30 if ces08_idnum == 8241
replace ces08_cps_intday = 9 if ces08_idnum == 8245
replace ces08_cps_intday = 9 if ces08_idnum == 8246
replace ces08_cps_intday = 28 if ces08_idnum == 8249
replace ces08_cps_intday = 28 if ces08_idnum == 8250
replace ces08_cps_intday = 30 if ces08_idnum == 8256
replace ces08_cps_intday = 28 if ces08_idnum == 8257
replace ces08_cps_intday = 28 if ces08_idnum == 8258
replace ces08_cps_intday = 28 if ces08_idnum == 8259
replace ces08_cps_intday = 28 if ces08_idnum == 8263
replace ces08_cps_intday = 5 if ces08_idnum == 8267
replace ces08_cps_intday = 28 if ces08_idnum == 8268
replace ces08_cps_intday = 10 if ces08_idnum == 8269
replace ces08_cps_intday = 29 if ces08_idnum == 8271
replace ces08_cps_intday = 1 if ces08_idnum == 8272
replace ces08_cps_intday = 8 if ces08_idnum == 8273
replace ces08_cps_intday = 29 if ces08_idnum == 8274
replace ces08_cps_intday = 28 if ces08_idnum == 8278
replace ces08_cps_intday = 28 if ces08_idnum == 8283
replace ces08_cps_intday = 11 if ces08_idnum == 8286
replace ces08_cps_intday = 28 if ces08_idnum == 8287
replace ces08_cps_intday = 28 if ces08_idnum == 8288
replace ces08_cps_intday = 5 if ces08_idnum == 8297
replace ces08_cps_intday = 28 if ces08_idnum == 8298
replace ces08_cps_intday = 9 if ces08_idnum == 8303
replace ces08_cps_intday = 12 if ces08_idnum == 8306
replace ces08_cps_intday = 11 if ces08_idnum == 8307
replace ces08_cps_intday = 30 if ces08_idnum == 8314
replace ces08_cps_intday = 7 if ces08_idnum == 8318
replace ces08_cps_intday = 28 if ces08_idnum == 8323
replace ces08_cps_intday = 30 if ces08_idnum == 8327
replace ces08_cps_intday = 6 if ces08_idnum == 8329
replace ces08_cps_intday = 6 if ces08_idnum == 8330
replace ces08_cps_intday = 2 if ces08_idnum == 8331
replace ces08_cps_intday = 28 if ces08_idnum == 8333
replace ces08_cps_intday = 28 if ces08_idnum == 8336
replace ces08_cps_intday = 11 if ces08_idnum == 8346
replace ces08_cps_intday = 11 if ces08_idnum == 8349
replace ces08_cps_intday = 28 if ces08_idnum == 8352
replace ces08_cps_intday = 28 if ces08_idnum == 8354
replace ces08_cps_intday = 28 if ces08_idnum == 8368
replace ces08_cps_intday = 1 if ces08_idnum == 8373
replace ces08_cps_intday = 28 if ces08_idnum == 8375
replace ces08_cps_intday = 1 if ces08_idnum == 8378
replace ces08_cps_intday = 7 if ces08_idnum == 8379
replace ces08_cps_intday = 2 if ces08_idnum == 8380
replace ces08_cps_intday = 28 if ces08_idnum == 8382
replace ces08_cps_intday = 8 if ces08_idnum == 8388
replace ces08_cps_intday = 28 if ces08_idnum == 8392
replace ces08_cps_intday = 28 if ces08_idnum == 8395
replace ces08_cps_intday = 1 if ces08_idnum == 8402
replace ces08_cps_intday = 2 if ces08_idnum == 8403
replace ces08_cps_intday = 7 if ces08_idnum == 8405
replace ces08_cps_intday = 30 if ces08_idnum == 8407
replace ces08_cps_intday = 28 if ces08_idnum == 8412
replace ces08_cps_intday = 28 if ces08_idnum == 8414
replace ces08_cps_intday = 28 if ces08_idnum == 8415
replace ces08_cps_intday = 8 if ces08_idnum == 8416
replace ces08_cps_intday = 7 if ces08_idnum == 8417
replace ces08_cps_intday = 28 if ces08_idnum == 8419
replace ces08_cps_intday = 30 if ces08_idnum == 8422
replace ces08_cps_intday = 29 if ces08_idnum == 8424
replace ces08_cps_intday = 30 if ces08_idnum == 8426
replace ces08_cps_intday = 5 if ces08_idnum == 8435
replace ces08_cps_intday = 28 if ces08_idnum == 8436
replace ces08_cps_intday = 11 if ces08_idnum == 8442
replace ces08_cps_intday = 3 if ces08_idnum == 8443
replace ces08_cps_intday = 5 if ces08_idnum == 8446
replace ces08_cps_intday = 13 if ces08_idnum == 8448
replace ces08_cps_intday = 29 if ces08_idnum == 8455
replace ces08_cps_intday = 1 if ces08_idnum == 8457
replace ces08_cps_intday = 2 if ces08_idnum == 8468
replace ces08_cps_intday = 10 if ces08_idnum == 8469
replace ces08_cps_intday = 28 if ces08_idnum == 8474
replace ces08_cps_intday = 6 if ces08_idnum == 8476
replace ces08_cps_intday = 9 if ces08_idnum == 8478
replace ces08_cps_intday = 13 if ces08_idnum == 8480
replace ces08_cps_intday = 12 if ces08_idnum == 8485
replace ces08_cps_intday = 5 if ces08_idnum == 8486
replace ces08_cps_intday = 30 if ces08_idnum == 8488
replace ces08_cps_intday = 4 if ces08_idnum == 8490
replace ces08_cps_intday = 30 if ces08_idnum == 8491
replace ces08_cps_intday = 1 if ces08_idnum == 8493
replace ces08_cps_intday = 10 if ces08_idnum == 8495
replace ces08_cps_intday = 8 if ces08_idnum == 8497
replace ces08_cps_intday = 29 if ces08_idnum == 8502
replace ces08_cps_intday = 12 if ces08_idnum == 8508
replace ces08_cps_intday = 8 if ces08_idnum == 8510
replace ces08_cps_intday = 7 if ces08_idnum == 8512
replace ces08_cps_intday = 6 if ces08_idnum == 8514
replace ces08_cps_intday = 4 if ces08_idnum == 8515
replace ces08_cps_intday = 8 if ces08_idnum == 8529
replace ces08_cps_intday = 30 if ces08_idnum == 8538
replace ces08_cps_intday = 29 if ces08_idnum == 8539
replace ces08_cps_intday = 4 if ces08_idnum == 8543
replace ces08_cps_intday = 7 if ces08_idnum == 8544
replace ces08_cps_intday = 30 if ces08_idnum == 8545
replace ces08_cps_intday = 29 if ces08_idnum == 8549
replace ces08_cps_intday = 30 if ces08_idnum == 8550
replace ces08_cps_intday = 4 if ces08_idnum == 8553
replace ces08_cps_intday = 9 if ces08_idnum == 8558
replace ces08_cps_intday = 30 if ces08_idnum == 8559
replace ces08_cps_intday = 7 if ces08_idnum == 8562
replace ces08_cps_intday = 1 if ces08_idnum == 8568
replace ces08_cps_intday = 29 if ces08_idnum == 8570
replace ces08_cps_intday = 12 if ces08_idnum == 8573
replace ces08_cps_intday = 29 if ces08_idnum == 8577
replace ces08_cps_intday = 29 if ces08_idnum == 8585
replace ces08_cps_intday = 11 if ces08_idnum == 8596
replace ces08_cps_intday = 4 if ces08_idnum == 8597
replace ces08_cps_intday = 9 if ces08_idnum == 8600
replace ces08_cps_intday = 10 if ces08_idnum == 8608
replace ces08_cps_intday = 29 if ces08_idnum == 8613
replace ces08_cps_intday = 9 if ces08_idnum == 8619
replace ces08_cps_intday = 4 if ces08_idnum == 8620
replace ces08_cps_intday = 30 if ces08_idnum == 8621
replace ces08_cps_intday = 2 if ces08_idnum == 8623
replace ces08_cps_intday = 29 if ces08_idnum == 8624
replace ces08_cps_intday = 9 if ces08_idnum == 8626
replace ces08_cps_intday = 12 if ces08_idnum == 8631
replace ces08_cps_intday = 4 if ces08_idnum == 8634
replace ces08_cps_intday = 3 if ces08_idnum == 8637
replace ces08_cps_intday = 2 if ces08_idnum == 8638
replace ces08_cps_intday = 29 if ces08_idnum == 8639
replace ces08_cps_intday = 10 if ces08_idnum == 8640
replace ces08_cps_intday = 2 if ces08_idnum == 8644
replace ces08_cps_intday = 8 if ces08_idnum == 8645
replace ces08_cps_intday = 4 if ces08_idnum == 8649
replace ces08_cps_intday = 29 if ces08_idnum == 8654
replace ces08_cps_intday = 12 if ces08_idnum == 8655
replace ces08_cps_intday = 29 if ces08_idnum == 8658
replace ces08_cps_intday = 2 if ces08_idnum == 8662
replace ces08_cps_intday = 8 if ces08_idnum == 8665
replace ces08_cps_intday = 9 if ces08_idnum == 8668
replace ces08_cps_intday = 4 if ces08_idnum == 8669
replace ces08_cps_intday = 5 if ces08_idnum == 8674
replace ces08_cps_intday = 6 if ces08_idnum == 8680
replace ces08_cps_intday = 3 if ces08_idnum == 8684
replace ces08_cps_intday = 12 if ces08_idnum == 8685
replace ces08_cps_intday = 1 if ces08_idnum == 8686
replace ces08_cps_intday = 29 if ces08_idnum == 8688
replace ces08_cps_intday = 29 if ces08_idnum == 8689
replace ces08_cps_intday = 29 if ces08_idnum == 8690
replace ces08_cps_intday = 6 if ces08_idnum == 8691
replace ces08_cps_intday = 4 if ces08_idnum == 8693
replace ces08_cps_intday = 8 if ces08_idnum == 8697
replace ces08_cps_intday = 29 if ces08_idnum == 8704
replace ces08_cps_intday = 8 if ces08_idnum == 8707
replace ces08_cps_intday = 9 if ces08_idnum == 8709
replace ces08_cps_intday = 4 if ces08_idnum == 8713
replace ces08_cps_intday = 9 if ces08_idnum == 8714
replace ces08_cps_intday = 29 if ces08_idnum == 8717
replace ces08_cps_intday = 1 if ces08_idnum == 8726
replace ces08_cps_intday = 8 if ces08_idnum == 8727
replace ces08_cps_intday = 8 if ces08_idnum == 8728
replace ces08_cps_intday = 11 if ces08_idnum == 8729
replace ces08_cps_intday = 29 if ces08_idnum == 8730
replace ces08_cps_intday = 3 if ces08_idnum == 8748
replace ces08_cps_intday = 30 if ces08_idnum == 8749
replace ces08_cps_intday = 30 if ces08_idnum == 8757
replace ces08_cps_intday = 9 if ces08_idnum == 8761
replace ces08_cps_intday = 29 if ces08_idnum == 8767
replace ces08_cps_intday = 29 if ces08_idnum == 8770
replace ces08_cps_intday = 11 if ces08_idnum == 8771
replace ces08_cps_intday = 4 if ces08_idnum == 8772
replace ces08_cps_intday = 13 if ces08_idnum == 8777
replace ces08_cps_intday = 4 if ces08_idnum == 8784
replace ces08_cps_intday = 5 if ces08_idnum == 8785
replace ces08_cps_intday = 2 if ces08_idnum == 8791
replace ces08_cps_intday = 8 if ces08_idnum == 8803
replace ces08_cps_intday = 5 if ces08_idnum == 8804
replace ces08_cps_intday = 5 if ces08_idnum == 8813
replace ces08_cps_intday = 29 if ces08_idnum == 8816
replace ces08_cps_intday = 29 if ces08_idnum == 8817
replace ces08_cps_intday = 29 if ces08_idnum == 8818
replace ces08_cps_intday = 2 if ces08_idnum == 8820
replace ces08_cps_intday = 30 if ces08_idnum == 8822
replace ces08_cps_intday = 12 if ces08_idnum == 8834
replace ces08_cps_intday = 29 if ces08_idnum == 8838
replace ces08_cps_intday = 12 if ces08_idnum == 8840
replace ces08_cps_intday = 10 if ces08_idnum == 8846
replace ces08_cps_intday = 9 if ces08_idnum == 8859
replace ces08_cps_intday = 6 if ces08_idnum == 8860
replace ces08_cps_intday = 8 if ces08_idnum == 8862
replace ces08_cps_intday = 11 if ces08_idnum == 8866
replace ces08_cps_intday = 30 if ces08_idnum == 8875
replace ces08_cps_intday = 4 if ces08_idnum == 8876
replace ces08_cps_intday = 30 if ces08_idnum == 8877
replace ces08_cps_intday = 29 if ces08_idnum == 8878
replace ces08_cps_intday = 30 if ces08_idnum == 8885
replace ces08_cps_intday = 3 if ces08_idnum == 8888
replace ces08_cps_intday = 5 if ces08_idnum == 8890
replace ces08_cps_intday = 5 if ces08_idnum == 8892
replace ces08_cps_intday = 5 if ces08_idnum == 8899
replace ces08_cps_intday = 6 if ces08_idnum == 8900
replace ces08_cps_intday = 5 if ces08_idnum == 8902
replace ces08_cps_intday = 2 if ces08_idnum == 8903
replace ces08_cps_intday = 5 if ces08_idnum == 8912
replace ces08_cps_intday = 29 if ces08_idnum == 8914
replace ces08_cps_intday = 29 if ces08_idnum == 8915
replace ces08_cps_intday = 2 if ces08_idnum == 8917
replace ces08_cps_intday = 6 if ces08_idnum == 8919
replace ces08_cps_intday = 29 if ces08_idnum == 8925
replace ces08_cps_intday = 5 if ces08_idnum == 8931
replace ces08_cps_intday = 6 if ces08_idnum == 8933
replace ces08_cps_intday = 2 if ces08_idnum == 8936
replace ces08_cps_intday = 10 if ces08_idnum == 8937
replace ces08_cps_intday = 11 if ces08_idnum == 8938
replace ces08_cps_intday = 7 if ces08_idnum == 8940
replace ces08_cps_intday = 4 if ces08_idnum == 8942
replace ces08_cps_intday = 12 if ces08_idnum == 8946
replace ces08_cps_intday = 2 if ces08_idnum == 8948
replace ces08_cps_intday = 29 if ces08_idnum == 8950
replace ces08_cps_intday = 5 if ces08_idnum == 8955
replace ces08_cps_intday = 29 if ces08_idnum == 8956
replace ces08_cps_intday = 1 if ces08_idnum == 8957
replace ces08_cps_intday = 29 if ces08_idnum == 8958
replace ces08_cps_intday = 30 if ces08_idnum == 8959
replace ces08_cps_intday = 9 if ces08_idnum == 8962
replace ces08_cps_intday = 29 if ces08_idnum == 8963
replace ces08_cps_intday = 8 if ces08_idnum == 8974
replace ces08_cps_intday = 29 if ces08_idnum == 8980
replace ces08_cps_intday = 10 if ces08_idnum == 8982
replace ces08_cps_intday = 5 if ces08_idnum == 8984
replace ces08_cps_intday = 29 if ces08_idnum == 8985
replace ces08_cps_intday = 1 if ces08_idnum == 8987
replace ces08_cps_intday = 9 if ces08_idnum == 8991
replace ces08_cps_intday = 1 if ces08_idnum == 8992
replace ces08_cps_intday = 6 if ces08_idnum == 8998
replace ces08_cps_intday = 29 if ces08_idnum == 9000
replace ces08_cps_intday = 29 if ces08_idnum == 9022
replace ces08_cps_intday = 30 if ces08_idnum == 9025
replace ces08_cps_intday = 12 if ces08_idnum == 9026
replace ces08_cps_intday = 11 if ces08_idnum == 9031
replace ces08_cps_intday = 9 if ces08_idnum == 9037
replace ces08_cps_intday = 9 if ces08_idnum == 9042
replace ces08_cps_intday = 7 if ces08_idnum == 9051
replace ces08_cps_intday = 29 if ces08_idnum == 9053
replace ces08_cps_intday = 13 if ces08_idnum == 9055
replace ces08_cps_intday = 4 if ces08_idnum == 9060
replace ces08_cps_intday = 30 if ces08_idnum == 9063
replace ces08_cps_intday = 8 if ces08_idnum == 9069
replace ces08_cps_intday = 10 if ces08_idnum == 9071
replace ces08_cps_intday = 2 if ces08_idnum == 9075
replace ces08_cps_intday = 11 if ces08_idnum == 9078
replace ces08_cps_intday = 9 if ces08_idnum == 9080
replace ces08_cps_intday = 30 if ces08_idnum == 9082
replace ces08_cps_intday = 2 if ces08_idnum == 9083
replace ces08_cps_intday = 8 if ces08_idnum == 9085
replace ces08_cps_intday = 5 if ces08_idnum == 9088
replace ces08_cps_intday = 1 if ces08_idnum == 9089
replace ces08_cps_intday = 4 if ces08_idnum == 9093
replace ces08_cps_intday = 2 if ces08_idnum == 9101
replace ces08_cps_intday = 10 if ces08_idnum == 9103
replace ces08_cps_intday = 8 if ces08_idnum == 9105
replace ces08_cps_intday = 12 if ces08_idnum == 9113
replace ces08_cps_intday = 13 if ces08_idnum == 9115
replace ces08_cps_intday = 2 if ces08_idnum == 9116
replace ces08_cps_intday = 30 if ces08_idnum == 9119
replace ces08_cps_intday = 30 if ces08_idnum == 9121
replace ces08_cps_intday = 30 if ces08_idnum == 9123
replace ces08_cps_intday = 2 if ces08_idnum == 9131
replace ces08_cps_intday = 5 if ces08_idnum == 9135
replace ces08_cps_intday = 30 if ces08_idnum == 9137
replace ces08_cps_intday = 13 if ces08_idnum == 9156
replace ces08_cps_intday = 4 if ces08_idnum == 9157
replace ces08_cps_intday = 5 if ces08_idnum == 9158
replace ces08_cps_intday = 2 if ces08_idnum == 9161
replace ces08_cps_intday = 30 if ces08_idnum == 9164
replace ces08_cps_intday = 30 if ces08_idnum == 9167
replace ces08_cps_intday = 11 if ces08_idnum == 9168
replace ces08_cps_intday = 7 if ces08_idnum == 9169
replace ces08_cps_intday = 30 if ces08_idnum == 9170
replace ces08_cps_intday = 1 if ces08_idnum == 9171
replace ces08_cps_intday = 30 if ces08_idnum == 9172
replace ces08_cps_intday = 10 if ces08_idnum == 9174
replace ces08_cps_intday = 11 if ces08_idnum == 9177
replace ces08_cps_intday = 30 if ces08_idnum == 9183
replace ces08_cps_intday = 7 if ces08_idnum == 9185
replace ces08_cps_intday = 5 if ces08_idnum == 9187
replace ces08_cps_intday = 4 if ces08_idnum == 9191
replace ces08_cps_intday = 13 if ces08_idnum == 9193
replace ces08_cps_intday = 5 if ces08_idnum == 9194
replace ces08_cps_intday = 1 if ces08_idnum == 9195
replace ces08_cps_intday = 8 if ces08_idnum == 9197
replace ces08_cps_intday = 11 if ces08_idnum == 9199
replace ces08_cps_intday = 5 if ces08_idnum == 9202
replace ces08_cps_intday = 11 if ces08_idnum == 9207
replace ces08_cps_intday = 2 if ces08_idnum == 9216
replace ces08_cps_intday = 2 if ces08_idnum == 9218
replace ces08_cps_intday = 3 if ces08_idnum == 9222
replace ces08_cps_intday = 3 if ces08_idnum == 9224
replace ces08_cps_intday = 2 if ces08_idnum == 9225
replace ces08_cps_intday = 2 if ces08_idnum == 9226
replace ces08_cps_intday = 30 if ces08_idnum == 9228
replace ces08_cps_intday = 30 if ces08_idnum == 9236
replace ces08_cps_intday = 2 if ces08_idnum == 9240
replace ces08_cps_intday = 12 if ces08_idnum == 9248
replace ces08_cps_intday = 6 if ces08_idnum == 9259
replace ces08_cps_intday = 3 if ces08_idnum == 9260
replace ces08_cps_intday = 30 if ces08_idnum == 9266
replace ces08_cps_intday = 30 if ces08_idnum == 9267
replace ces08_cps_intday = 4 if ces08_idnum == 9269
replace ces08_cps_intday = 4 if ces08_idnum == 9270
replace ces08_cps_intday = 2 if ces08_idnum == 9272
replace ces08_cps_intday = 4 if ces08_idnum == 9276
replace ces08_cps_intday = 30 if ces08_idnum == 9280
replace ces08_cps_intday = 30 if ces08_idnum == 9281
replace ces08_cps_intday = 30 if ces08_idnum == 9282
replace ces08_cps_intday = 4 if ces08_idnum == 9285
replace ces08_cps_intday = 1 if ces08_idnum == 9286
replace ces08_cps_intday = 1 if ces08_idnum == 9287
replace ces08_cps_intday = 12 if ces08_idnum == 9290
replace ces08_cps_intday = 30 if ces08_idnum == 9291
replace ces08_cps_intday = 9 if ces08_idnum == 9292
replace ces08_cps_intday = 3 if ces08_idnum == 9293
replace ces08_cps_intday = 10 if ces08_idnum == 9294
replace ces08_cps_intday = 30 if ces08_idnum == 9299
replace ces08_cps_intday = 30 if ces08_idnum == 9306
replace ces08_cps_intday = 5 if ces08_idnum == 9308
replace ces08_cps_intday = 2 if ces08_idnum == 9309
replace ces08_cps_intday = 2 if ces08_idnum == 9320
replace ces08_cps_intday = 30 if ces08_idnum == 9324
replace ces08_cps_intday = 5 if ces08_idnum == 9326
replace ces08_cps_intday = 12 if ces08_idnum == 9327
replace ces08_cps_intday = 2 if ces08_idnum == 9331
replace ces08_cps_intday = 11 if ces08_idnum == 9345
replace ces08_cps_intday = 9 if ces08_idnum == 9347
replace ces08_cps_intday = 30 if ces08_idnum == 9349
replace ces08_cps_intday = 7 if ces08_idnum == 9369
replace ces08_cps_intday = 30 if ces08_idnum == 9373
replace ces08_cps_intday = 7 if ces08_idnum == 9374
replace ces08_cps_intday = 4 if ces08_idnum == 9376
replace ces08_cps_intday = 13 if ces08_idnum == 9379
replace ces08_cps_intday = 12 if ces08_idnum == 9380
replace ces08_cps_intday = 2 if ces08_idnum == 9386
replace ces08_cps_intday = 9 if ces08_idnum == 9389
replace ces08_cps_intday = 2 if ces08_idnum == 9390
replace ces08_cps_intday = 8 if ces08_idnum == 9392
replace ces08_cps_intday = 30 if ces08_idnum == 9398
replace ces08_cps_intday = 9 if ces08_idnum == 9399
replace ces08_cps_intday = 30 if ces08_idnum == 9400
replace ces08_cps_intday = 11 if ces08_idnum == 9407
replace ces08_cps_intday = 8 if ces08_idnum == 9408
replace ces08_cps_intday = 8 if ces08_idnum == 9411
replace ces08_cps_intday = 5 if ces08_idnum == 9416
replace ces08_cps_intday = 9 if ces08_idnum == 9427
replace ces08_cps_intday = 7 if ces08_idnum == 9431
replace ces08_cps_intday = 9 if ces08_idnum == 9432
replace ces08_cps_intday = 2 if ces08_idnum == 9434
replace ces08_cps_intday = 3 if ces08_idnum == 9435
replace ces08_cps_intday = 30 if ces08_idnum == 9436
replace ces08_cps_intday = 3 if ces08_idnum == 9451
replace ces08_cps_intday = 9 if ces08_idnum == 9454
replace ces08_cps_intday = 12 if ces08_idnum == 9455
replace ces08_cps_intday = 6 if ces08_idnum == 9457
replace ces08_cps_intday = 9 if ces08_idnum == 9461
replace ces08_cps_intday = 30 if ces08_idnum == 9462
replace ces08_cps_intday = 30 if ces08_idnum == 9464
replace ces08_cps_intday = 30 if ces08_idnum == 9465
replace ces08_cps_intday = 2 if ces08_idnum == 9466
replace ces08_cps_intday = 30 if ces08_idnum == 9467
replace ces08_cps_intday = 4 if ces08_idnum == 9470
replace ces08_cps_intday = 12 if ces08_idnum == 9471
replace ces08_cps_intday = 8 if ces08_idnum == 9476
replace ces08_cps_intday = 5 if ces08_idnum == 9477
replace ces08_cps_intday = 7 if ces08_idnum == 9478
replace ces08_cps_intday = 30 if ces08_idnum == 9483
replace ces08_cps_intday = 5 if ces08_idnum == 9485
replace ces08_cps_intday = 6 if ces08_idnum == 9487
replace ces08_cps_intday = 2 if ces08_idnum == 9495
replace ces08_cps_intday = 5 if ces08_idnum == 9498
replace ces08_cps_intday = 3 if ces08_idnum == 9499
replace ces08_cps_intday = 1 if ces08_idnum == 9501
replace ces08_cps_intday = 3 if ces08_idnum == 9509
replace ces08_cps_intday = 9 if ces08_idnum == 9513
replace ces08_cps_intday = 9 if ces08_idnum == 9515
replace ces08_cps_intday = 1 if ces08_idnum == 9517
replace ces08_cps_intday = 1 if ces08_idnum == 9518
replace ces08_cps_intday = 5 if ces08_idnum == 9521
replace ces08_cps_intday = 1 if ces08_idnum == 9529
replace ces08_cps_intday = 11 if ces08_idnum == 9536
replace ces08_cps_intday = 4 if ces08_idnum == 9539
replace ces08_cps_intday = 11 if ces08_idnum == 9541
replace ces08_cps_intday = 6 if ces08_idnum == 9544
replace ces08_cps_intday = 1 if ces08_idnum == 9545
replace ces08_cps_intday = 10 if ces08_idnum == 9569
replace ces08_cps_intday = 7 if ces08_idnum == 9577
replace ces08_cps_intday = 1 if ces08_idnum == 9579
replace ces08_cps_intday = 1 if ces08_idnum == 9580
replace ces08_cps_intday = 7 if ces08_idnum == 9591
replace ces08_cps_intday = 11 if ces08_idnum == 9592
replace ces08_cps_intday = 12 if ces08_idnum == 9595
replace ces08_cps_intday = 5 if ces08_idnum == 9596
replace ces08_cps_intday = 2 if ces08_idnum == 9597
replace ces08_cps_intday = 6 if ces08_idnum == 9599
replace ces08_cps_intday = 1 if ces08_idnum == 9601
replace ces08_cps_intday = 5 if ces08_idnum == 9611
replace ces08_cps_intday = 2 if ces08_idnum == 9612
replace ces08_cps_intday = 7 if ces08_idnum == 9613
replace ces08_cps_intday = 4 if ces08_idnum == 9618
replace ces08_cps_intday = 9 if ces08_idnum == 9620
replace ces08_cps_intday = 13 if ces08_idnum == 9624
replace ces08_cps_intday = 13 if ces08_idnum == 9627
replace ces08_cps_intday = 1 if ces08_idnum == 9630
replace ces08_cps_intday = 2 if ces08_idnum == 9631
replace ces08_cps_intday = 6 if ces08_idnum == 9635
replace ces08_cps_intday = 7 if ces08_idnum == 9637
replace ces08_cps_intday = 4 if ces08_idnum == 9639
replace ces08_cps_intday = 1 if ces08_idnum == 9658
replace ces08_cps_intday = 4 if ces08_idnum == 9659
replace ces08_cps_intday = 11 if ces08_idnum == 9663
replace ces08_cps_intday = 8 if ces08_idnum == 9664
replace ces08_cps_intday = 6 if ces08_idnum == 9670
replace ces08_cps_intday = 6 if ces08_idnum == 9674
replace ces08_cps_intday = 1 if ces08_idnum == 9683
replace ces08_cps_intday = 1 if ces08_idnum == 9686
replace ces08_cps_intday = 3 if ces08_idnum == 9689
replace ces08_cps_intday = 10 if ces08_idnum == 9695
replace ces08_cps_intday = 12 if ces08_idnum == 9698
replace ces08_cps_intday = 9 if ces08_idnum == 9709
replace ces08_cps_intday = 2 if ces08_idnum == 9711
replace ces08_cps_intday = 13 if ces08_idnum == 9712
replace ces08_cps_intday = 7 if ces08_idnum == 9725
replace ces08_cps_intday = 11 if ces08_idnum == 9727
replace ces08_cps_intday = 11 if ces08_idnum == 9737
replace ces08_cps_intday = 7 if ces08_idnum == 9746
replace ces08_cps_intday = 4 if ces08_idnum == 9747
replace ces08_cps_intday = 7 if ces08_idnum == 9749
replace ces08_cps_intday = 9 if ces08_idnum == 9750
replace ces08_cps_intday = 2 if ces08_idnum == 9753
replace ces08_cps_intday = 5 if ces08_idnum == 9757
replace ces08_cps_intday = 13 if ces08_idnum == 9758
replace ces08_cps_intday = 7 if ces08_idnum == 9759
replace ces08_cps_intday = 12 if ces08_idnum == 9762
replace ces08_cps_intday = 4 if ces08_idnum == 9766
replace ces08_cps_intday = 10 if ces08_idnum == 9768
replace ces08_cps_intday = 12 if ces08_idnum == 9772
replace ces08_cps_intday = 1 if ces08_idnum == 9779
replace ces08_cps_intday = 7 if ces08_idnum == 9783
replace ces08_cps_intday = 2 if ces08_idnum == 9788
replace ces08_cps_intday = 13 if ces08_idnum == 9792
replace ces08_cps_intday = 8 if ces08_idnum == 9793
replace ces08_cps_intday = 9 if ces08_idnum == 9794
replace ces08_cps_intday = 2 if ces08_idnum == 9795
replace ces08_cps_intday = 2 if ces08_idnum == 9801
replace ces08_cps_intday = 3 if ces08_idnum == 9807
replace ces08_cps_intday = 2 if ces08_idnum == 9808
replace ces08_cps_intday = 9 if ces08_idnum == 9814
replace ces08_cps_intday = 2 if ces08_idnum == 9816
replace ces08_cps_intday = 2 if ces08_idnum == 9820
replace ces08_cps_intday = 3 if ces08_idnum == 9831
replace ces08_cps_intday = 11 if ces08_idnum == 9835
replace ces08_cps_intday = 5 if ces08_idnum == 9838
replace ces08_cps_intday = 8 if ces08_idnum == 9841
replace ces08_cps_intday = 11 if ces08_idnum == 9842
replace ces08_cps_intday = 2 if ces08_idnum == 9845
replace ces08_cps_intday = 9 if ces08_idnum == 9854
replace ces08_cps_intday = 2 if ces08_idnum == 9857
replace ces08_cps_intday = 2 if ces08_idnum == 9861
replace ces08_cps_intday = 5 if ces08_idnum == 9863
replace ces08_cps_intday = 3 if ces08_idnum == 9865
replace ces08_cps_intday = 5 if ces08_idnum == 9866
replace ces08_cps_intday = 5 if ces08_idnum == 9868
replace ces08_cps_intday = 9 if ces08_idnum == 9871
replace ces08_cps_intday = 5 if ces08_idnum == 9874
replace ces08_cps_intday = 3 if ces08_idnum == 9876
replace ces08_cps_intday = 4 if ces08_idnum == 9881
replace ces08_cps_intday = 2 if ces08_idnum == 9882
replace ces08_cps_intday = 6 if ces08_idnum == 9888
replace ces08_cps_intday = 2 if ces08_idnum == 9890
replace ces08_cps_intday = 2 if ces08_idnum == 9894
replace ces08_cps_intday = 6 if ces08_idnum == 9895
replace ces08_cps_intday = 6 if ces08_idnum == 9899
replace ces08_cps_intday = 4 if ces08_idnum == 9900
replace ces08_cps_intday = 2 if ces08_idnum == 9904
replace ces08_cps_intday = 3 if ces08_idnum == 9906
replace ces08_cps_intday = 2 if ces08_idnum == 9908
replace ces08_cps_intday = 3 if ces08_idnum == 9909
replace ces08_cps_intday = 5 if ces08_idnum == 9910
replace ces08_cps_intday = 4 if ces08_idnum == 9911
replace ces08_cps_intday = 8 if ces08_idnum == 9926
replace ces08_cps_intday = 4 if ces08_idnum == 9932
replace ces08_cps_intday = 6 if ces08_idnum == 9934
replace ces08_cps_intday = 2 if ces08_idnum == 9935
replace ces08_cps_intday = 10 if ces08_idnum == 9940
replace ces08_cps_intday = 12 if ces08_idnum == 9949
replace ces08_cps_intday = 2 if ces08_idnum == 9950
replace ces08_cps_intday = 4 if ces08_idnum == 9956
replace ces08_cps_intday = 2 if ces08_idnum == 9959
replace ces08_cps_intday = 7 if ces08_idnum == 9960
replace ces08_cps_intday = 4 if ces08_idnum == 9962
replace ces08_cps_intday = 13 if ces08_idnum == 9964
replace ces08_cps_intday = 7 if ces08_idnum == 9966
replace ces08_cps_intday = 2 if ces08_idnum == 9967
replace ces08_cps_intday = 4 if ces08_idnum == 9973
replace ces08_cps_intday = 11 if ces08_idnum == 9977
replace ces08_cps_intday = 3 if ces08_idnum == 9978
replace ces08_cps_intday = 6 if ces08_idnum == 9981
replace ces08_cps_intday = 12 if ces08_idnum == 9983
replace ces08_cps_intday = 6 if ces08_idnum == 9984
replace ces08_cps_intday = 5 if ces08_idnum == 9987
replace ces08_cps_intday = 6 if ces08_idnum == 9988
replace ces08_cps_intday = 2 if ces08_idnum == 9990
replace ces08_cps_intday = 2 if ces08_idnum == 9993
replace ces08_cps_intday = 2 if ces08_idnum == 9996
replace ces08_cps_intday = 3 if ces08_idnum == 9997
replace ces08_cps_intday = 7 if ces08_idnum == 9999
replace ces08_cps_intday = 11 if ces08_idnum == 10000
replace ces08_cps_intday = 4 if ces08_idnum == 10009
replace ces08_cps_intday = 3 if ces08_idnum == 10011
replace ces08_cps_intday = 5 if ces08_idnum == 10023
replace ces08_cps_intday = 5 if ces08_idnum == 10034
replace ces08_cps_intday = 4 if ces08_idnum == 10037
replace ces08_cps_intday = 9 if ces08_idnum == 10050
replace ces08_cps_intday = 4 if ces08_idnum == 10052
replace ces08_cps_intday = 11 if ces08_idnum == 10053
replace ces08_cps_intday = 5 if ces08_idnum == 10055
replace ces08_cps_intday = 9 if ces08_idnum == 10057
replace ces08_cps_intday = 3 if ces08_idnum == 10060
replace ces08_cps_intday = 9 if ces08_idnum == 10064
replace ces08_cps_intday = 3 if ces08_idnum == 10068
replace ces08_cps_intday = 3 if ces08_idnum == 10073
replace ces08_cps_intday = 9 if ces08_idnum == 10091
replace ces08_cps_intday = 9 if ces08_idnum == 10095
replace ces08_cps_intday = 5 if ces08_idnum == 10096
replace ces08_cps_intday = 10 if ces08_idnum == 10097
replace ces08_cps_intday = 5 if ces08_idnum == 10100
replace ces08_cps_intday = 5 if ces08_idnum == 10105
replace ces08_cps_intday = 3 if ces08_idnum == 10108
replace ces08_cps_intday = 10 if ces08_idnum == 10115
replace ces08_cps_intday = 6 if ces08_idnum == 10116
replace ces08_cps_intday = 13 if ces08_idnum == 10118
replace ces08_cps_intday = 4 if ces08_idnum == 10120
replace ces08_cps_intday = 4 if ces08_idnum == 10123
replace ces08_cps_intday = 8 if ces08_idnum == 10124
replace ces08_cps_intday = 3 if ces08_idnum == 10134
replace ces08_cps_intday = 3 if ces08_idnum == 10137
replace ces08_cps_intday = 7 if ces08_idnum == 10138
replace ces08_cps_intday = 13 if ces08_idnum == 10143
replace ces08_cps_intday = 3 if ces08_idnum == 10145
replace ces08_cps_intday = 11 if ces08_idnum == 10146
replace ces08_cps_intday = 9 if ces08_idnum == 10151
replace ces08_cps_intday = 12 if ces08_idnum == 10153
replace ces08_cps_intday = 5 if ces08_idnum == 10155
replace ces08_cps_intday = 9 if ces08_idnum == 10157
replace ces08_cps_intday = 5 if ces08_idnum == 10159
replace ces08_cps_intday = 3 if ces08_idnum == 10162
replace ces08_cps_intday = 4 if ces08_idnum == 10177
replace ces08_cps_intday = 4 if ces08_idnum == 10181
replace ces08_cps_intday = 10 if ces08_idnum == 10184
replace ces08_cps_intday = 7 if ces08_idnum == 10190
replace ces08_cps_intday = 3 if ces08_idnum == 10193
replace ces08_cps_intday = 3 if ces08_idnum == 10196
replace ces08_cps_intday = 3 if ces08_idnum == 10197
replace ces08_cps_intday = 4 if ces08_idnum == 10199
replace ces08_cps_intday = 13 if ces08_idnum == 10206
replace ces08_cps_intday = 8 if ces08_idnum == 10214
replace ces08_cps_intday = 13 if ces08_idnum == 10217
replace ces08_cps_intday = 8 if ces08_idnum == 10218
replace ces08_cps_intday = 7 if ces08_idnum == 10219
replace ces08_cps_intday = 4 if ces08_idnum == 10220
replace ces08_cps_intday = 8 if ces08_idnum == 10223
replace ces08_cps_intday = 6 if ces08_idnum == 10228
replace ces08_cps_intday = 3 if ces08_idnum == 10229
replace ces08_cps_intday = 3 if ces08_idnum == 10233
replace ces08_cps_intday = 12 if ces08_idnum == 10240
replace ces08_cps_intday = 13 if ces08_idnum == 10245
replace ces08_cps_intday = 3 if ces08_idnum == 10246
replace ces08_cps_intday = 13 if ces08_idnum == 10253
replace ces08_cps_intday = 10 if ces08_idnum == 10261
replace ces08_cps_intday = 3 if ces08_idnum == 10263
replace ces08_cps_intday = 7 if ces08_idnum == 10267
replace ces08_cps_intday = 3 if ces08_idnum == 10272
replace ces08_cps_intday = 4 if ces08_idnum == 10273
replace ces08_cps_intday = 12 if ces08_idnum == 10275
replace ces08_cps_intday = 11 if ces08_idnum == 10277
replace ces08_cps_intday = 13 if ces08_idnum == 10281
replace ces08_cps_intday = 7 if ces08_idnum == 10284
replace ces08_cps_intday = 6 if ces08_idnum == 10285
replace ces08_cps_intday = 13 if ces08_idnum == 10289
replace ces08_cps_intday = 4 if ces08_idnum == 10296
replace ces08_cps_intday = 4 if ces08_idnum == 10299
replace ces08_cps_intday = 9 if ces08_idnum == 10301
replace ces08_cps_intday = 10 if ces08_idnum == 10305
replace ces08_cps_intday = 8 if ces08_idnum == 10306
replace ces08_cps_intday = 5 if ces08_idnum == 10312
replace ces08_cps_intday = 4 if ces08_idnum == 10326
replace ces08_cps_intday = 12 if ces08_idnum == 10328
replace ces08_cps_intday = 3 if ces08_idnum == 10329
replace ces08_cps_intday = 3 if ces08_idnum == 10335
replace ces08_cps_intday = 4 if ces08_idnum == 10338
replace ces08_cps_intday = 3 if ces08_idnum == 10340
replace ces08_cps_intday = 11 if ces08_idnum == 10348
replace ces08_cps_intday = 3 if ces08_idnum == 10351
replace ces08_cps_intday = 13 if ces08_idnum == 10353
replace ces08_cps_intday = 4 if ces08_idnum == 10363
replace ces08_cps_intday = 8 if ces08_idnum == 10366
replace ces08_cps_intday = 3 if ces08_idnum == 10367
replace ces08_cps_intday = 7 if ces08_idnum == 10369
replace ces08_cps_intday = 7 if ces08_idnum == 10370
replace ces08_cps_intday = 12 if ces08_idnum == 10373
replace ces08_cps_intday = 13 if ces08_idnum == 10378
replace ces08_cps_intday = 6 if ces08_idnum == 10382
replace ces08_cps_intday = 5 if ces08_idnum == 10385
replace ces08_cps_intday = 5 if ces08_idnum == 10386
replace ces08_cps_intday = 3 if ces08_idnum == 10390
replace ces08_cps_intday = 3 if ces08_idnum == 10392
replace ces08_cps_intday = 13 if ces08_idnum == 10395
replace ces08_cps_intday = 9 if ces08_idnum == 10399
replace ces08_cps_intday = 13 if ces08_idnum == 10401
replace ces08_cps_intday = 3 if ces08_idnum == 10402
replace ces08_cps_intday = 3 if ces08_idnum == 10404
replace ces08_cps_intday = 4 if ces08_idnum == 10405
replace ces08_cps_intday = 3 if ces08_idnum == 10409
replace ces08_cps_intday = 4 if ces08_idnum == 10410
replace ces08_cps_intday = 13 if ces08_idnum == 10413
replace ces08_cps_intday = 7 if ces08_idnum == 10417
replace ces08_cps_intday = 3 if ces08_idnum == 10419
replace ces08_cps_intday = 3 if ces08_idnum == 10420
replace ces08_cps_intday = 4 if ces08_idnum == 10423
replace ces08_cps_intday = 9 if ces08_idnum == 10426
replace ces08_cps_intday = 4 if ces08_idnum == 10436
replace ces08_cps_intday = 3 if ces08_idnum == 10438
replace ces08_cps_intday = 7 if ces08_idnum == 10449
replace ces08_cps_intday = 6 if ces08_idnum == 10450
replace ces08_cps_intday = 4 if ces08_idnum == 10452
replace ces08_cps_intday = 4 if ces08_idnum == 10453
replace ces08_cps_intday = 7 if ces08_idnum == 10454
replace ces08_cps_intday = 6 if ces08_idnum == 10455
replace ces08_cps_intday = 9 if ces08_idnum == 10456
replace ces08_cps_intday = 12 if ces08_idnum == 10461
replace ces08_cps_intday = 9 if ces08_idnum == 10462
replace ces08_cps_intday = 5 if ces08_idnum == 10463
replace ces08_cps_intday = 3 if ces08_idnum == 10464
replace ces08_cps_intday = 6 if ces08_idnum == 10465
replace ces08_cps_intday = 11 if ces08_idnum == 10474
replace ces08_cps_intday = 6 if ces08_idnum == 10476
replace ces08_cps_intday = 9 if ces08_idnum == 10478
replace ces08_cps_intday = 4 if ces08_idnum == 10479
replace ces08_cps_intday = 5 if ces08_idnum == 10480
replace ces08_cps_intday = 11 if ces08_idnum == 10482
replace ces08_cps_intday = 3 if ces08_idnum == 10483
replace ces08_cps_intday = 12 if ces08_idnum == 10484
replace ces08_cps_intday = 3 if ces08_idnum == 10488
replace ces08_cps_intday = 5 if ces08_idnum == 10494
replace ces08_cps_intday = 7 if ces08_idnum == 10506
replace ces08_cps_intday = 13 if ces08_idnum == 10526
replace ces08_cps_intday = 8 if ces08_idnum == 10530
replace ces08_cps_intday = 11 if ces08_idnum == 10534
replace ces08_cps_intday = 8 if ces08_idnum == 10542
replace ces08_cps_intday = 6 if ces08_idnum == 10566
replace ces08_cps_intday = 6 if ces08_idnum == 10574
replace ces08_cps_intday = 6 if ces08_idnum == 10582
replace ces08_cps_intday = 11 if ces08_idnum == 10598
replace ces08_cps_intday = 8 if ces08_idnum == 10600
replace ces08_cps_intday = 13 if ces08_idnum == 10612
replace ces08_cps_intday = 8 if ces08_idnum == 10640
replace ces08_cps_intday = 11 if ces08_idnum == 10658
replace ces08_cps_intday = 7 if ces08_idnum == 10662
replace ces08_cps_intday = 6 if ces08_idnum == 10664
replace ces08_cps_intday = 13 if ces08_idnum == 10670
replace ces08_cps_intday = 7 if ces08_idnum == 10680
replace ces08_cps_intday = 10 if ces08_idnum == 10684
replace ces08_cps_intday = 6 if ces08_idnum == 10688
replace ces08_cps_intday = 11 if ces08_idnum == 10690
replace ces08_cps_intday = 9 if ces08_idnum == 10702
replace ces08_cps_intday = 6 if ces08_idnum == 10712
replace ces08_cps_intday = 12 if ces08_idnum == 10728
replace ces08_cps_intday = 12 if ces08_idnum == 10734
replace ces08_cps_intday = 7 if ces08_idnum == 10744
replace ces08_cps_intday = 6 if ces08_idnum == 10746
replace ces08_cps_intday = 6 if ces08_idnum == 10760
replace ces08_cps_intday = 9 if ces08_idnum == 10796
replace ces08_cps_intday = 6 if ces08_idnum == 10820
replace ces08_cps_intday = 6 if ces08_idnum == 10832
replace ces08_cps_intday = 7 if ces08_idnum == 10842
replace ces08_cps_intday = 6 if ces08_idnum == 10856
replace ces08_cps_intday = 6 if ces08_idnum == 10862
replace ces08_cps_intday = 6 if ces08_idnum == 10864
replace ces08_cps_intday = 6 if ces08_idnum == 10878
replace ces08_cps_intday = 7 if ces08_idnum == 10882
replace ces08_cps_intday = 8 if ces08_idnum == 10888
replace ces08_cps_intday = 9 if ces08_idnum == 10890
replace ces08_cps_intday = 5 if ces08_idnum == 12001
replace ces08_cps_intday = 6 if ces08_idnum == 12002
replace ces08_cps_intday = 28 if ces08_idnum == 12004
replace ces08_cps_intday = 4 if ces08_idnum == 12007
replace ces08_cps_intday = 28 if ces08_idnum == 12009
replace ces08_cps_intday = 2 if ces08_idnum == 12010
replace ces08_cps_intday = 28 if ces08_idnum == 12011
replace ces08_cps_intday = 6 if ces08_idnum == 12014
replace ces08_cps_intday = 28 if ces08_idnum == 12018
replace ces08_cps_intday = 3 if ces08_idnum == 12019
replace ces08_cps_intday = 3 if ces08_idnum == 12021
replace ces08_cps_intday = 4 if ces08_idnum == 12022
replace ces08_cps_intday = 3 if ces08_idnum == 12024
replace ces08_cps_intday = 30 if ces08_idnum == 12025
replace ces08_cps_intday = 11 if ces08_idnum == 12027
replace ces08_cps_intday = 30 if ces08_idnum == 12028
replace ces08_cps_intday = 2 if ces08_idnum == 12030
replace ces08_cps_intday = 3 if ces08_idnum == 12037
replace ces08_cps_intday = 28 if ces08_idnum == 12047
replace ces08_cps_intday = 4 if ces08_idnum == 12048
replace ces08_cps_intday = 11 if ces08_idnum == 12051
replace ces08_cps_intday = 26 if ces08_idnum == 12052
replace ces08_cps_intday = 3 if ces08_idnum == 12053
replace ces08_cps_intday = 30 if ces08_idnum == 12056
replace ces08_cps_intday = 6 if ces08_idnum == 12057
replace ces08_cps_intday = 9 if ces08_idnum == 12058
replace ces08_cps_intday = 29 if ces08_idnum == 12059
replace ces08_cps_intday = 28 if ces08_idnum == 12060
replace ces08_cps_intday = 28 if ces08_idnum == 12066
replace ces08_cps_intday = 9 if ces08_idnum == 12069
replace ces08_cps_intday = 28 if ces08_idnum == 12071
replace ces08_cps_intday = 29 if ces08_idnum == 12086
replace ces08_cps_intday = 7 if ces08_idnum == 12090
replace ces08_cps_intday = 9 if ces08_idnum == 12091
replace ces08_cps_intday = 7 if ces08_idnum == 12093
replace ces08_cps_intday = 27 if ces08_idnum == 12095
replace ces08_cps_intday = 8 if ces08_idnum == 12096
replace ces08_cps_intday = 27 if ces08_idnum == 12097
replace ces08_cps_intday = 27 if ces08_idnum == 12099
replace ces08_cps_intday = 2 if ces08_idnum == 12103
replace ces08_cps_intday = 11 if ces08_idnum == 12106
replace ces08_cps_intday = 5 if ces08_idnum == 12112
replace ces08_cps_intday = 7 if ces08_idnum == 12115
replace ces08_cps_intday = 27 if ces08_idnum == 12119
replace ces08_cps_intday = 30 if ces08_idnum == 12127
replace ces08_cps_intday = 28 if ces08_idnum == 12129
replace ces08_cps_intday = 3 if ces08_idnum == 12132
replace ces08_cps_intday = 28 if ces08_idnum == 12134
replace ces08_cps_intday = 28 if ces08_idnum == 12138
replace ces08_cps_intday = 11 if ces08_idnum == 12145
replace ces08_cps_intday = 28 if ces08_idnum == 12149
replace ces08_cps_intday = 28 if ces08_idnum == 12153
replace ces08_cps_intday = 30 if ces08_idnum == 12154
replace ces08_cps_intday = 28 if ces08_idnum == 12157
replace ces08_cps_intday = 5 if ces08_idnum == 12161
replace ces08_cps_intday = 27 if ces08_idnum == 12163
replace ces08_cps_intday = 30 if ces08_idnum == 12165
replace ces08_cps_intday = 29 if ces08_idnum == 12168
replace ces08_cps_intday = 11 if ces08_idnum == 12169
replace ces08_cps_intday = 6 if ces08_idnum == 12171
replace ces08_cps_intday = 6 if ces08_idnum == 12176
replace ces08_cps_intday = 8 if ces08_idnum == 12182
replace ces08_cps_intday = 13 if ces08_idnum == 12183
replace ces08_cps_intday = 29 if ces08_idnum == 12184
replace ces08_cps_intday = 12 if ces08_idnum == 12187
replace ces08_cps_intday = 29 if ces08_idnum == 12188
replace ces08_cps_intday = 29 if ces08_idnum == 12192
replace ces08_cps_intday = 29 if ces08_idnum == 12201
replace ces08_cps_intday = 13 if ces08_idnum == 12206
replace ces08_cps_intday = 30 if ces08_idnum == 12210
replace ces08_cps_intday = 1 if ces08_idnum == 12211
replace ces08_cps_intday = 9 if ces08_idnum == 12212
replace ces08_cps_intday = 30 if ces08_idnum == 12215
replace ces08_cps_intday = 12 if ces08_idnum == 12218
replace ces08_cps_intday = 6 if ces08_idnum == 12219
replace ces08_cps_intday = 30 if ces08_idnum == 12220
replace ces08_cps_intday = 8 if ces08_idnum == 12223
replace ces08_cps_intday = 5 if ces08_idnum == 12224
replace ces08_cps_intday = 7 if ces08_idnum == 12232
replace ces08_cps_intday = 9 if ces08_idnum == 12234
replace ces08_cps_intday = 29 if ces08_idnum == 12235
replace ces08_cps_intday = 29 if ces08_idnum == 12236
replace ces08_cps_intday = 9 if ces08_idnum == 12240
replace ces08_cps_intday = 1 if ces08_idnum == 12241
replace ces08_cps_intday = 1 if ces08_idnum == 12242
replace ces08_cps_intday = 9 if ces08_idnum == 12244
replace ces08_cps_intday = 29 if ces08_idnum == 12247
replace ces08_cps_intday = 29 if ces08_idnum == 12248
replace ces08_cps_intday = 6 if ces08_idnum == 12249
replace ces08_cps_intday = 4 if ces08_idnum == 12250
replace ces08_cps_intday = 5 if ces08_idnum == 12256
replace ces08_cps_intday = 7 if ces08_idnum == 12257
replace ces08_cps_intday = 3 if ces08_idnum == 12259
replace ces08_cps_intday = 30 if ces08_idnum == 12261
replace ces08_cps_intday = 7 if ces08_idnum == 12262
replace ces08_cps_intday = 4 if ces08_idnum == 12263
replace ces08_cps_intday = 1 if ces08_idnum == 12264
replace ces08_cps_intday = 6 if ces08_idnum == 12269
replace ces08_cps_intday = 11 if ces08_idnum == 12270
replace ces08_cps_intday = 5 if ces08_idnum == 12273
replace ces08_cps_intday = 29 if ces08_idnum == 12277
replace ces08_cps_intday = 9 if ces08_idnum == 12279
replace ces08_cps_intday = 9 if ces08_idnum == 12282
replace ces08_cps_intday = 8 if ces08_idnum == 12285
replace ces08_cps_intday = 8 if ces08_idnum == 12286
replace ces08_cps_intday = 9 if ces08_idnum == 12287
replace ces08_cps_intday = 2 if ces08_idnum == 12291
replace ces08_cps_intday = 2 if ces08_idnum == 12292
replace ces08_cps_intday = 3 if ces08_idnum == 12293
replace ces08_cps_intday = 3 if ces08_idnum == 12294
replace ces08_cps_intday = 4 if ces08_idnum == 12295
replace ces08_cps_intday = 8 if ces08_idnum == 12298
replace ces08_cps_intday = 30 if ces08_idnum == 12299
replace ces08_cps_intday = 11 if ces08_idnum == 12300
replace ces08_cps_intday = 13 if ces08_idnum == 12305
replace ces08_cps_intday = 5 if ces08_idnum == 12307
replace ces08_cps_intday = 4 if ces08_idnum == 12310
replace ces08_cps_intday = 7 if ces08_idnum == 12313
replace ces08_cps_intday = 7 if ces08_idnum == 12314
replace ces08_cps_intday = 5 if ces08_idnum == 12320
replace ces08_cps_intday = 3 if ces08_idnum == 12325
replace ces08_cps_intday = 10 if ces08_idnum == 12327
replace ces08_cps_intday = 3 if ces08_idnum == 12328
replace ces08_cps_intday = 5 if ces08_idnum == 12333
replace ces08_cps_intday = 12 if ces08_idnum == 12339
replace ces08_cps_intday = 10 if ces08_idnum == 12342
replace ces08_cps_intday = 3 if ces08_idnum == 12352
replace ces08_cps_intday = 5 if ces08_idnum == 12354
replace ces08_cps_intday = 9 if ces08_idnum == 12356
replace ces08_cps_intday = 6 if ces08_idnum == 12362
replace ces08_cps_intday = 12 if ces08_idnum == 12363
replace ces08_cps_intday = 6 if ces08_idnum == 12365
replace ces08_cps_intday = 8 if ces08_idnum == 12366
replace ces08_cps_intday = 7 if ces08_idnum == 12368
replace ces08_cps_intday = 9 if ces08_idnum == 12369
replace ces08_cps_intday = 6 if ces08_idnum == 12370
replace ces08_cps_intday = 9 if ces08_idnum == 12372
replace ces08_cps_intday = 6 if ces08_idnum == 12375
replace ces08_cps_intday = 6 if ces08_idnum == 12376
replace ces08_cps_intday = 7 if ces08_idnum == 12380
replace ces08_cps_intday = 7 if ces08_idnum == 12385
replace ces08_cps_intday = 8 if ces08_idnum == 12387
replace ces08_cps_intday = 12 if ces08_idnum == 12395
replace ces08_cps_intday = 6 if ces08_idnum == 12400
replace ces08_cps_intday = 6 if ces08_idnum == 12401
replace ces08_cps_intday = 12 if ces08_idnum == 12409
replace ces08_cps_intday = 11 if ces08_idnum == 12410
replace ces08_cps_intday = 13 if ces08_idnum == 12413
replace ces08_cps_intday = 7 if ces08_idnum == 12415
replace ces08_cps_intday = 10 if ces08_idnum == 12416
replace ces08_cps_intday = 7 if ces08_idnum == 12603
replace ces08_cps_intday = 26 if ces08_idnum == 12607
replace ces08_cps_intday = 27 if ces08_idnum == 12609
replace ces08_cps_intday = 26 if ces08_idnum == 12612
replace ces08_cps_intday = 29 if ces08_idnum == 12616
replace ces08_cps_intday = 28 if ces08_idnum == 12617
replace ces08_cps_intday = 28 if ces08_idnum == 12620
replace ces08_cps_intday = 30 if ces08_idnum == 12623
replace ces08_cps_intday = 28 if ces08_idnum == 12624
replace ces08_cps_intday = 4 if ces08_idnum == 12626
replace ces08_cps_intday = 29 if ces08_idnum == 12628
replace ces08_cps_intday = 7 if ces08_idnum == 12635
replace ces08_cps_intday = 28 if ces08_idnum == 12637
replace ces08_cps_intday = 11 if ces08_idnum == 12638
replace ces08_cps_intday = 27 if ces08_idnum == 12641
replace ces08_cps_intday = 9 if ces08_idnum == 12645
replace ces08_cps_intday = 1 if ces08_idnum == 12646
replace ces08_cps_intday = 9 if ces08_idnum == 12649
replace ces08_cps_intday = 5 if ces08_idnum == 12652
replace ces08_cps_intday = 11 if ces08_idnum == 12654
replace ces08_cps_intday = 28 if ces08_idnum == 12655
replace ces08_cps_intday = 2 if ces08_idnum == 12661
replace ces08_cps_intday = 5 if ces08_idnum == 12665
replace ces08_cps_intday = 29 if ces08_idnum == 12667
replace ces08_cps_intday = 12 if ces08_idnum == 12670
replace ces08_cps_intday = 28 if ces08_idnum == 12671
replace ces08_cps_intday = 6 if ces08_idnum == 12672
replace ces08_cps_intday = 5 if ces08_idnum == 12673
replace ces08_cps_intday = 4 if ces08_idnum == 12676
replace ces08_cps_intday = 27 if ces08_idnum == 12677
replace ces08_cps_intday = 2 if ces08_idnum == 12679
replace ces08_cps_intday = 5 if ces08_idnum == 12680
replace ces08_cps_intday = 28 if ces08_idnum == 12683
replace ces08_cps_intday = 12 if ces08_idnum == 12684
replace ces08_cps_intday = 28 if ces08_idnum == 12685
replace ces08_cps_intday = 28 if ces08_idnum == 12686
replace ces08_cps_intday = 27 if ces08_idnum == 12690
replace ces08_cps_intday = 4 if ces08_idnum == 12693
replace ces08_cps_intday = 10 if ces08_idnum == 12694
replace ces08_cps_intday = 30 if ces08_idnum == 12697
replace ces08_cps_intday = 30 if ces08_idnum == 12698
replace ces08_cps_intday = 4 if ces08_idnum == 12699
replace ces08_cps_intday = 6 if ces08_idnum == 12708
replace ces08_cps_intday = 27 if ces08_idnum == 12709
replace ces08_cps_intday = 9 if ces08_idnum == 12710
replace ces08_cps_intday = 12 if ces08_idnum == 12711
replace ces08_cps_intday = 4 if ces08_idnum == 12712
replace ces08_cps_intday = 7 if ces08_idnum == 12714
replace ces08_cps_intday = 29 if ces08_idnum == 12718
replace ces08_cps_intday = 30 if ces08_idnum == 12720
replace ces08_cps_intday = 4 if ces08_idnum == 12722
replace ces08_cps_intday = 4 if ces08_idnum == 12724
replace ces08_cps_intday = 1 if ces08_idnum == 12725
replace ces08_cps_intday = 27 if ces08_idnum == 12728
replace ces08_cps_intday = 28 if ces08_idnum == 12731
replace ces08_cps_intday = 10 if ces08_idnum == 12732
replace ces08_cps_intday = 7 if ces08_idnum == 12733
replace ces08_cps_intday = 29 if ces08_idnum == 12735
replace ces08_cps_intday = 4 if ces08_idnum == 12745
replace ces08_cps_intday = 5 if ces08_idnum == 12746
replace ces08_cps_intday = 11 if ces08_idnum == 12751
replace ces08_cps_intday = 6 if ces08_idnum == 12752
replace ces08_cps_intday = 30 if ces08_idnum == 12754
replace ces08_cps_intday = 27 if ces08_idnum == 12756
replace ces08_cps_intday = 9 if ces08_idnum == 12761
replace ces08_cps_intday = 13 if ces08_idnum == 12762
replace ces08_cps_intday = 28 if ces08_idnum == 12769
replace ces08_cps_intday = 7 if ces08_idnum == 12774
replace ces08_cps_intday = 30 if ces08_idnum == 12777
replace ces08_cps_intday = 28 if ces08_idnum == 12779
replace ces08_cps_intday = 13 if ces08_idnum == 12780
replace ces08_cps_intday = 1 if ces08_idnum == 12781
replace ces08_cps_intday = 30 if ces08_idnum == 12783
replace ces08_cps_intday = 30 if ces08_idnum == 12784
replace ces08_cps_intday = 2 if ces08_idnum == 12787
replace ces08_cps_intday = 8 if ces08_idnum == 12789
replace ces08_cps_intday = 29 if ces08_idnum == 12792
replace ces08_cps_intday = 13 if ces08_idnum == 12793
replace ces08_cps_intday = 10 if ces08_idnum == 12794
replace ces08_cps_intday = 30 if ces08_idnum == 12798
replace ces08_cps_intday = 29 if ces08_idnum == 12799
replace ces08_cps_intday = 30 if ces08_idnum == 12800
replace ces08_cps_intday = 29 if ces08_idnum == 12805
replace ces08_cps_intday = 1 if ces08_idnum == 12812
replace ces08_cps_intday = 1 if ces08_idnum == 12813
replace ces08_cps_intday = 30 if ces08_idnum == 12815
replace ces08_cps_intday = 29 if ces08_idnum == 12819
replace ces08_cps_intday = 29 if ces08_idnum == 12820
replace ces08_cps_intday = 7 if ces08_idnum == 12821
replace ces08_cps_intday = 12 if ces08_idnum == 12823
replace ces08_cps_intday = 11 if ces08_idnum == 12831
replace ces08_cps_intday = 12 if ces08_idnum == 12832
replace ces08_cps_intday = 2 if ces08_idnum == 12837
replace ces08_cps_intday = 4 if ces08_idnum == 12841
replace ces08_cps_intday = 29 if ces08_idnum == 12842
replace ces08_cps_intday = 10 if ces08_idnum == 12845
replace ces08_cps_intday = 8 if ces08_idnum == 12854
replace ces08_cps_intday = 2 if ces08_idnum == 12855
replace ces08_cps_intday = 30 if ces08_idnum == 12856
replace ces08_cps_intday = 5 if ces08_idnum == 12858
replace ces08_cps_intday = 4 if ces08_idnum == 12860
replace ces08_cps_intday = 29 if ces08_idnum == 12862
replace ces08_cps_intday = 6 if ces08_idnum == 12864
replace ces08_cps_intday = 29 if ces08_idnum == 12867
replace ces08_cps_intday = 9 if ces08_idnum == 12869
replace ces08_cps_intday = 7 if ces08_idnum == 12873
replace ces08_cps_intday = 5 if ces08_idnum == 12874
replace ces08_cps_intday = 13 if ces08_idnum == 12880
replace ces08_cps_intday = 5 if ces08_idnum == 12881
replace ces08_cps_intday = 2 if ces08_idnum == 12884
replace ces08_cps_intday = 29 if ces08_idnum == 12886
replace ces08_cps_intday = 29 if ces08_idnum == 12887
replace ces08_cps_intday = 30 if ces08_idnum == 12888
replace ces08_cps_intday = 1 if ces08_idnum == 12890
replace ces08_cps_intday = 6 if ces08_idnum == 12895
replace ces08_cps_intday = 8 if ces08_idnum == 12898
replace ces08_cps_intday = 8 if ces08_idnum == 12899
replace ces08_cps_intday = 10 if ces08_idnum == 12909
replace ces08_cps_intday = 9 if ces08_idnum == 12915
replace ces08_cps_intday = 5 if ces08_idnum == 12921
replace ces08_cps_intday = 3 if ces08_idnum == 12922
replace ces08_cps_intday = 4 if ces08_idnum == 12925
replace ces08_cps_intday = 4 if ces08_idnum == 12928
replace ces08_cps_intday = 4 if ces08_idnum == 12929
replace ces08_cps_intday = 3 if ces08_idnum == 12933
replace ces08_cps_intday = 4 if ces08_idnum == 12934
replace ces08_cps_intday = 4 if ces08_idnum == 12940
replace ces08_cps_intday = 4 if ces08_idnum == 12941
replace ces08_cps_intday = 10 if ces08_idnum == 12943
replace ces08_cps_intday = 8 if ces08_idnum == 12950
replace ces08_cps_intday = 13 if ces08_idnum == 12955
replace ces08_cps_intday = 3 if ces08_idnum == 12958
replace ces08_cps_intday = 6 if ces08_idnum == 12963
replace ces08_cps_intday = 7 if ces08_idnum == 12966
replace ces08_cps_intday = 6 if ces08_idnum == 12975
replace ces08_cps_intday = 6 if ces08_idnum == 12987
replace ces08_cps_intday = 8 if ces08_idnum == 12990
replace ces08_cps_intday = 7 if ces08_idnum == 12996
replace ces08_cps_intday = 8 if ces08_idnum == 13017
replace ces08_cps_intday = 10 if ces08_idnum == 13020
replace ces08_cps_intday = 9 if ces08_idnum == 13203
replace ces08_cps_intday = 28 if ces08_idnum == 13206
replace ces08_cps_intday = 7 if ces08_idnum == 13208
replace ces08_cps_intday = 26 if ces08_idnum == 13209
replace ces08_cps_intday = 30 if ces08_idnum == 13211
replace ces08_cps_intday = 26 if ces08_idnum == 13212
replace ces08_cps_intday = 9 if ces08_idnum == 13215
replace ces08_cps_intday = 13 if ces08_idnum == 13217
replace ces08_cps_intday = 9 if ces08_idnum == 13218
replace ces08_cps_intday = 8 if ces08_idnum == 13219
replace ces08_cps_intday = 8 if ces08_idnum == 13221
replace ces08_cps_intday = 2 if ces08_idnum == 13225
replace ces08_cps_intday = 4 if ces08_idnum == 13226
replace ces08_cps_intday = 8 if ces08_idnum == 13228
replace ces08_cps_intday = 5 if ces08_idnum == 13232
replace ces08_cps_intday = 8 if ces08_idnum == 13233
replace ces08_cps_intday = 26 if ces08_idnum == 13236
replace ces08_cps_intday = 26 if ces08_idnum == 13237
replace ces08_cps_intday = 4 if ces08_idnum == 13238
replace ces08_cps_intday = 29 if ces08_idnum == 13246
replace ces08_cps_intday = 7 if ces08_idnum == 13247
replace ces08_cps_intday = 8 if ces08_idnum == 13261
replace ces08_cps_intday = 7 if ces08_idnum == 13262
replace ces08_cps_intday = 1 if ces08_idnum == 13270
replace ces08_cps_intday = 2 if ces08_idnum == 13272
replace ces08_cps_intday = 28 if ces08_idnum == 13276
replace ces08_cps_intday = 7 if ces08_idnum == 13279
replace ces08_cps_intday = 27 if ces08_idnum == 13280
replace ces08_cps_intday = 5 if ces08_idnum == 13281
replace ces08_cps_intday = 28 if ces08_idnum == 13286
replace ces08_cps_intday = 27 if ces08_idnum == 13293
replace ces08_cps_intday = 1 if ces08_idnum == 13295
replace ces08_cps_intday = 2 if ces08_idnum == 13297
replace ces08_cps_intday = 27 if ces08_idnum == 13306
replace ces08_cps_intday = 6 if ces08_idnum == 13316
replace ces08_cps_intday = 9 if ces08_idnum == 13321
replace ces08_cps_intday = 27 if ces08_idnum == 13325
replace ces08_cps_intday = 27 if ces08_idnum == 13326
replace ces08_cps_intday = 5 if ces08_idnum == 13327
replace ces08_cps_intday = 30 if ces08_idnum == 13332
replace ces08_cps_intday = 29 if ces08_idnum == 13334
replace ces08_cps_intday = 28 if ces08_idnum == 13335
replace ces08_cps_intday = 27 if ces08_idnum == 13338
replace ces08_cps_intday = 28 if ces08_idnum == 13339
replace ces08_cps_intday = 27 if ces08_idnum == 13340
replace ces08_cps_intday = 1 if ces08_idnum == 13344
replace ces08_cps_intday = 11 if ces08_idnum == 13347
replace ces08_cps_intday = 5 if ces08_idnum == 13352
replace ces08_cps_intday = 28 if ces08_idnum == 13354
replace ces08_cps_intday = 10 if ces08_idnum == 13355
replace ces08_cps_intday = 28 if ces08_idnum == 13357
replace ces08_cps_intday = 4 if ces08_idnum == 13361
replace ces08_cps_intday = 11 if ces08_idnum == 13363
replace ces08_cps_intday = 10 if ces08_idnum == 13366
replace ces08_cps_intday = 27 if ces08_idnum == 13368
replace ces08_cps_intday = 11 if ces08_idnum == 13377
replace ces08_cps_intday = 27 if ces08_idnum == 13381
replace ces08_cps_intday = 1 if ces08_idnum == 13382
replace ces08_cps_intday = 28 if ces08_idnum == 13388
replace ces08_cps_intday = 7 if ces08_idnum == 13390
replace ces08_cps_intday = 27 if ces08_idnum == 13399
replace ces08_cps_intday = 30 if ces08_idnum == 13402
replace ces08_cps_intday = 28 if ces08_idnum == 13404
replace ces08_cps_intday = 12 if ces08_idnum == 13409
replace ces08_cps_intday = 29 if ces08_idnum == 13411
replace ces08_cps_intday = 5 if ces08_idnum == 13412
replace ces08_cps_intday = 8 if ces08_idnum == 13417
replace ces08_cps_intday = 8 if ces08_idnum == 13422
replace ces08_cps_intday = 4 if ces08_idnum == 13428
replace ces08_cps_intday = 1 if ces08_idnum == 13434
replace ces08_cps_intday = 13 if ces08_idnum == 13437
replace ces08_cps_intday = 9 if ces08_idnum == 13440
replace ces08_cps_intday = 2 if ces08_idnum == 13441
replace ces08_cps_intday = 6 if ces08_idnum == 13442
replace ces08_cps_intday = 11 if ces08_idnum == 13445
replace ces08_cps_intday = 1 if ces08_idnum == 13447
replace ces08_cps_intday = 3 if ces08_idnum == 13452
replace ces08_cps_intday = 9 if ces08_idnum == 13454
replace ces08_cps_intday = 11 if ces08_idnum == 13461
replace ces08_cps_intday = 30 if ces08_idnum == 13464
replace ces08_cps_intday = 4 if ces08_idnum == 13468
replace ces08_cps_intday = 6 if ces08_idnum == 13469
replace ces08_cps_intday = 6 if ces08_idnum == 13471
replace ces08_cps_intday = 8 if ces08_idnum == 13473
replace ces08_cps_intday = 13 if ces08_idnum == 13478
replace ces08_cps_intday = 29 if ces08_idnum == 13484
replace ces08_cps_intday = 2 if ces08_idnum == 13486
replace ces08_cps_intday = 29 if ces08_idnum == 13487
replace ces08_cps_intday = 29 if ces08_idnum == 13488
replace ces08_cps_intday = 30 if ces08_idnum == 13493
replace ces08_cps_intday = 8 if ces08_idnum == 13497
replace ces08_cps_intday = 8 if ces08_idnum == 13499
replace ces08_cps_intday = 30 if ces08_idnum == 13503
replace ces08_cps_intday = 9 if ces08_idnum == 13506
replace ces08_cps_intday = 29 if ces08_idnum == 13508
replace ces08_cps_intday = 8 if ces08_idnum == 13510
replace ces08_cps_intday = 12 if ces08_idnum == 13511
replace ces08_cps_intday = 6 if ces08_idnum == 13512
replace ces08_cps_intday = 29 if ces08_idnum == 13515
replace ces08_cps_intday = 4 if ces08_idnum == 13516
replace ces08_cps_intday = 7 if ces08_idnum == 13517
replace ces08_cps_intday = 4 if ces08_idnum == 13521
replace ces08_cps_intday = 11 if ces08_idnum == 13524
replace ces08_cps_intday = 29 if ces08_idnum == 13537
replace ces08_cps_intday = 5 if ces08_idnum == 13546
replace ces08_cps_intday = 5 if ces08_idnum == 13548
replace ces08_cps_intday = 7 if ces08_idnum == 13549
replace ces08_cps_intday = 5 if ces08_idnum == 13551
replace ces08_cps_intday = 3 if ces08_idnum == 13553
replace ces08_cps_intday = 5 if ces08_idnum == 13567
replace ces08_cps_intday = 4 if ces08_idnum == 13568
replace ces08_cps_intday = 13 if ces08_idnum == 13569
replace ces08_cps_intday = 10 if ces08_idnum == 13571
replace ces08_cps_intday = 4 if ces08_idnum == 13577
replace ces08_cps_intday = 3 if ces08_idnum == 13581
replace ces08_cps_intday = 7 if ces08_idnum == 13582
replace ces08_cps_intday = 5 if ces08_idnum == 13585
replace ces08_cps_intday = 3 if ces08_idnum == 13586
replace ces08_cps_intday = 4 if ces08_idnum == 13588
replace ces08_cps_intday = 7 if ces08_idnum == 13591
replace ces08_cps_intday = 11 if ces08_idnum == 13592
replace ces08_cps_intday = 5 if ces08_idnum == 13598
replace ces08_cps_intday = 8 if ces08_idnum == 13600
replace ces08_cps_intday = 8 if ces08_idnum == 13602
replace ces08_cps_intday = 4 if ces08_idnum == 13606
replace ces08_cps_intday = 9 if ces08_idnum == 13608
replace ces08_cps_intday = 12 if ces08_idnum == 13610
replace ces08_cps_intday = 10 if ces08_idnum == 13623
replace ces08_cps_intday = 6 if ces08_idnum == 13629
replace ces08_cps_intday = 7 if ces08_idnum == 13641
replace ces08_cps_intday = 6 if ces08_idnum == 13644
replace ces08_cps_intday = 8 if ces08_idnum == 13648
replace ces08_cps_intday = 7 if ces08_idnum == 13650
replace ces08_cps_intday = 6 if ces08_idnum == 13651
replace ces08_cps_intday = 8 if ces08_idnum == 13653
replace ces08_cps_intday = 9 if ces08_idnum == 13654
replace ces08_cps_intday = 6 if ces08_idnum == 13666
replace ces08_cps_intday = 8 if ces08_idnum == 13669
replace ces08_cps_intday = 6 if ces08_idnum == 13675
replace ces08_cps_intday = 7 if ces08_idnum == 13677
replace ces08_cps_intday = 7 if ces08_idnum == 13680
replace ces08_cps_intday = 8 if ces08_idnum == 13688
replace ces08_cps_intday = 7 if ces08_idnum == 13689
replace ces08_cps_intday = 3 if ces08_idnum == 13902
replace ces08_cps_intday = 1 if ces08_idnum == 13904
replace ces08_cps_intday = 11 if ces08_idnum == 13908
replace ces08_cps_intday = 10 if ces08_idnum == 13916
replace ces08_cps_intday = 30 if ces08_idnum == 13917
replace ces08_cps_intday = 6 if ces08_idnum == 13923
replace ces08_cps_intday = 7 if ces08_idnum == 13926
replace ces08_cps_intday = 27 if ces08_idnum == 13929
replace ces08_cps_intday = 8 if ces08_idnum == 13931
replace ces08_cps_intday = 11 if ces08_idnum == 13937
replace ces08_cps_intday = 9 if ces08_idnum == 13938
replace ces08_cps_intday = 11 if ces08_idnum == 13945
replace ces08_cps_intday = 28 if ces08_idnum == 13946
replace ces08_cps_intday = 5 if ces08_idnum == 13947
replace ces08_cps_intday = 13 if ces08_idnum == 13951
replace ces08_cps_intday = 7 if ces08_idnum == 13955
replace ces08_cps_intday = 13 if ces08_idnum == 13959
replace ces08_cps_intday = 28 if ces08_idnum == 13960
replace ces08_cps_intday = 12 if ces08_idnum == 13962
replace ces08_cps_intday = 2 if ces08_idnum == 13966
replace ces08_cps_intday = 28 if ces08_idnum == 13986
replace ces08_cps_intday = 6 if ces08_idnum == 13988
replace ces08_cps_intday = 28 if ces08_idnum == 13993
replace ces08_cps_intday = 28 if ces08_idnum == 13994
replace ces08_cps_intday = 26 if ces08_idnum == 13995
replace ces08_cps_intday = 6 if ces08_idnum == 13996
replace ces08_cps_intday = 28 if ces08_idnum == 13997
replace ces08_cps_intday = 2 if ces08_idnum == 14006
replace ces08_cps_intday = 2 if ces08_idnum == 14008
replace ces08_cps_intday = 27 if ces08_idnum == 14011
replace ces08_cps_intday = 2 if ces08_idnum == 14013
replace ces08_cps_intday = 29 if ces08_idnum == 14014
replace ces08_cps_intday = 27 if ces08_idnum == 14022
replace ces08_cps_intday = 29 if ces08_idnum == 14023
replace ces08_cps_intday = 28 if ces08_idnum == 14027
replace ces08_cps_intday = 8 if ces08_idnum == 14034
replace ces08_cps_intday = 2 if ces08_idnum == 14037
replace ces08_cps_intday = 27 if ces08_idnum == 14042
replace ces08_cps_intday = 6 if ces08_idnum == 14044
replace ces08_cps_intday = 8 if ces08_idnum == 14047
replace ces08_cps_intday = 7 if ces08_idnum == 14062
replace ces08_cps_intday = 27 if ces08_idnum == 14063
replace ces08_cps_intday = 28 if ces08_idnum == 14074
replace ces08_cps_intday = 8 if ces08_idnum == 14077
replace ces08_cps_intday = 27 if ces08_idnum == 14079
replace ces08_cps_intday = 27 if ces08_idnum == 14089
replace ces08_cps_intday = 27 if ces08_idnum == 14091
replace ces08_cps_intday = 13 if ces08_idnum == 14097
replace ces08_cps_intday = 4 if ces08_idnum == 14102
replace ces08_cps_intday = 27 if ces08_idnum == 14108
replace ces08_cps_intday = 9 if ces08_idnum == 14111
replace ces08_cps_intday = 7 if ces08_idnum == 14113
replace ces08_cps_intday = 5 if ces08_idnum == 14119
replace ces08_cps_intday = 6 if ces08_idnum == 14124
replace ces08_cps_intday = 27 if ces08_idnum == 14129
replace ces08_cps_intday = 30 if ces08_idnum == 14134
replace ces08_cps_intday = 12 if ces08_idnum == 14135
replace ces08_cps_intday = 28 if ces08_idnum == 14139
replace ces08_cps_intday = 30 if ces08_idnum == 14141
replace ces08_cps_intday = 28 if ces08_idnum == 14143
replace ces08_cps_intday = 29 if ces08_idnum == 14145
replace ces08_cps_intday = 27 if ces08_idnum == 14149
replace ces08_cps_intday = 13 if ces08_idnum == 14153
replace ces08_cps_intday = 27 if ces08_idnum == 14155
replace ces08_cps_intday = 28 if ces08_idnum == 14158
replace ces08_cps_intday = 9 if ces08_idnum == 14162
replace ces08_cps_intday = 9 if ces08_idnum == 14165
replace ces08_cps_intday = 30 if ces08_idnum == 14166
replace ces08_cps_intday = 2 if ces08_idnum == 14171
replace ces08_cps_intday = 30 if ces08_idnum == 14175
replace ces08_cps_intday = 2 if ces08_idnum == 14176
replace ces08_cps_intday = 7 if ces08_idnum == 14182
replace ces08_cps_intday = 27 if ces08_idnum == 14183
replace ces08_cps_intday = 2 if ces08_idnum == 14186
replace ces08_cps_intday = 1 if ces08_idnum == 14188
replace ces08_cps_intday = 4 if ces08_idnum == 14192
replace ces08_cps_intday = 6 if ces08_idnum == 14196
replace ces08_cps_intday = 8 if ces08_idnum == 14198
replace ces08_cps_intday = 27 if ces08_idnum == 14199
replace ces08_cps_intday = 27 if ces08_idnum == 14201
replace ces08_cps_intday = 30 if ces08_idnum == 14209
replace ces08_cps_intday = 27 if ces08_idnum == 14211
replace ces08_cps_intday = 10 if ces08_idnum == 14212
replace ces08_cps_intday = 27 if ces08_idnum == 14215
replace ces08_cps_intday = 1 if ces08_idnum == 14218
replace ces08_cps_intday = 29 if ces08_idnum == 14220
replace ces08_cps_intday = 2 if ces08_idnum == 14222
replace ces08_cps_intday = 29 if ces08_idnum == 14229
replace ces08_cps_intday = 10 if ces08_idnum == 14238
replace ces08_cps_intday = 6 if ces08_idnum == 14240
replace ces08_cps_intday = 27 if ces08_idnum == 14247
replace ces08_cps_intday = 7 if ces08_idnum == 14248
replace ces08_cps_intday = 27 if ces08_idnum == 14249
replace ces08_cps_intday = 28 if ces08_idnum == 14251
replace ces08_cps_intday = 5 if ces08_idnum == 14254
replace ces08_cps_intday = 27 if ces08_idnum == 14262
replace ces08_cps_intday = 6 if ces08_idnum == 14265
replace ces08_cps_intday = 28 if ces08_idnum == 14269
replace ces08_cps_intday = 27 if ces08_idnum == 14270
replace ces08_cps_intday = 27 if ces08_idnum == 14271
replace ces08_cps_intday = 30 if ces08_idnum == 14279
replace ces08_cps_intday = 2 if ces08_idnum == 14280
replace ces08_cps_intday = 27 if ces08_idnum == 14283
replace ces08_cps_intday = 4 if ces08_idnum == 14286
replace ces08_cps_intday = 13 if ces08_idnum == 14290
replace ces08_cps_intday = 2 if ces08_idnum == 14291
replace ces08_cps_intday = 2 if ces08_idnum == 14293
replace ces08_cps_intday = 27 if ces08_idnum == 14303
replace ces08_cps_intday = 6 if ces08_idnum == 14306
replace ces08_cps_intday = 1 if ces08_idnum == 14309
replace ces08_cps_intday = 4 if ces08_idnum == 14311
replace ces08_cps_intday = 28 if ces08_idnum == 14319
replace ces08_cps_intday = 28 if ces08_idnum == 14326
replace ces08_cps_intday = 5 if ces08_idnum == 14332
replace ces08_cps_intday = 5 if ces08_idnum == 14334
replace ces08_cps_intday = 4 if ces08_idnum == 14336
replace ces08_cps_intday = 5 if ces08_idnum == 14340
replace ces08_cps_intday = 30 if ces08_idnum == 14341
replace ces08_cps_intday = 27 if ces08_idnum == 14349
replace ces08_cps_intday = 11 if ces08_idnum == 14355
replace ces08_cps_intday = 5 if ces08_idnum == 14356
replace ces08_cps_intday = 12 if ces08_idnum == 14360
replace ces08_cps_intday = 9 if ces08_idnum == 14363
replace ces08_cps_intday = 3 if ces08_idnum == 14365
replace ces08_cps_intday = 27 if ces08_idnum == 14371
replace ces08_cps_intday = 27 if ces08_idnum == 14373
replace ces08_cps_intday = 2 if ces08_idnum == 14379
replace ces08_cps_intday = 1 if ces08_idnum == 14384
replace ces08_cps_intday = 4 if ces08_idnum == 14387
replace ces08_cps_intday = 6 if ces08_idnum == 14390
replace ces08_cps_intday = 4 if ces08_idnum == 14395
replace ces08_cps_intday = 11 if ces08_idnum == 14398
replace ces08_cps_intday = 4 if ces08_idnum == 14405
replace ces08_cps_intday = 27 if ces08_idnum == 14406
replace ces08_cps_intday = 2 if ces08_idnum == 14408
replace ces08_cps_intday = 1 if ces08_idnum == 14412
replace ces08_cps_intday = 4 if ces08_idnum == 14416
replace ces08_cps_intday = 28 if ces08_idnum == 14418
replace ces08_cps_intday = 30 if ces08_idnum == 14422
replace ces08_cps_intday = 10 if ces08_idnum == 14423
replace ces08_cps_intday = 10 if ces08_idnum == 14431
replace ces08_cps_intday = 9 if ces08_idnum == 14432
replace ces08_cps_intday = 1 if ces08_idnum == 14433
replace ces08_cps_intday = 5 if ces08_idnum == 14434
replace ces08_cps_intday = 9 if ces08_idnum == 14437
replace ces08_cps_intday = 30 if ces08_idnum == 14442
replace ces08_cps_intday = 28 if ces08_idnum == 14443
replace ces08_cps_intday = 6 if ces08_idnum == 14444
replace ces08_cps_intday = 8 if ces08_idnum == 14445
replace ces08_cps_intday = 27 if ces08_idnum == 14454
replace ces08_cps_intday = 28 if ces08_idnum == 14456
replace ces08_cps_intday = 28 if ces08_idnum == 14461
replace ces08_cps_intday = 7 if ces08_idnum == 14466
replace ces08_cps_intday = 4 if ces08_idnum == 14469
replace ces08_cps_intday = 29 if ces08_idnum == 14473
replace ces08_cps_intday = 2 if ces08_idnum == 14476
replace ces08_cps_intday = 12 if ces08_idnum == 14479
replace ces08_cps_intday = 3 if ces08_idnum == 14486
replace ces08_cps_intday = 2 if ces08_idnum == 14488
replace ces08_cps_intday = 13 if ces08_idnum == 14495
replace ces08_cps_intday = 30 if ces08_idnum == 14497
replace ces08_cps_intday = 28 if ces08_idnum == 14500
replace ces08_cps_intday = 29 if ces08_idnum == 14507
replace ces08_cps_intday = 29 if ces08_idnum == 14509
replace ces08_cps_intday = 4 if ces08_idnum == 14510
replace ces08_cps_intday = 8 if ces08_idnum == 14519
replace ces08_cps_intday = 1 if ces08_idnum == 14520
replace ces08_cps_intday = 6 if ces08_idnum == 14523
replace ces08_cps_intday = 28 if ces08_idnum == 14528
replace ces08_cps_intday = 3 if ces08_idnum == 14531
replace ces08_cps_intday = 10 if ces08_idnum == 14537
replace ces08_cps_intday = 11 if ces08_idnum == 14544
replace ces08_cps_intday = 28 if ces08_idnum == 14548
replace ces08_cps_intday = 28 if ces08_idnum == 14552
replace ces08_cps_intday = 1 if ces08_idnum == 14559
replace ces08_cps_intday = 6 if ces08_idnum == 14562
replace ces08_cps_intday = 2 if ces08_idnum == 14563
replace ces08_cps_intday = 4 if ces08_idnum == 14566
replace ces08_cps_intday = 28 if ces08_idnum == 14567
replace ces08_cps_intday = 9 if ces08_idnum == 14568
replace ces08_cps_intday = 11 if ces08_idnum == 14569
replace ces08_cps_intday = 28 if ces08_idnum == 14576
replace ces08_cps_intday = 3 if ces08_idnum == 14577
replace ces08_cps_intday = 28 if ces08_idnum == 14580
replace ces08_cps_intday = 28 if ces08_idnum == 14582
replace ces08_cps_intday = 30 if ces08_idnum == 14586
replace ces08_cps_intday = 12 if ces08_idnum == 14587
replace ces08_cps_intday = 7 if ces08_idnum == 14588
replace ces08_cps_intday = 13 if ces08_idnum == 14589
replace ces08_cps_intday = 28 if ces08_idnum == 14598
replace ces08_cps_intday = 13 if ces08_idnum == 14601
replace ces08_cps_intday = 11 if ces08_idnum == 14602
replace ces08_cps_intday = 28 if ces08_idnum == 14608
replace ces08_cps_intday = 13 if ces08_idnum == 14611
replace ces08_cps_intday = 6 if ces08_idnum == 14612
replace ces08_cps_intday = 8 if ces08_idnum == 14615
replace ces08_cps_intday = 6 if ces08_idnum == 14621
replace ces08_cps_intday = 6 if ces08_idnum == 14623
replace ces08_cps_intday = 28 if ces08_idnum == 14629
replace ces08_cps_intday = 28 if ces08_idnum == 14630
replace ces08_cps_intday = 5 if ces08_idnum == 14631
replace ces08_cps_intday = 28 if ces08_idnum == 14635
replace ces08_cps_intday = 1 if ces08_idnum == 14637
replace ces08_cps_intday = 28 if ces08_idnum == 14638
replace ces08_cps_intday = 8 if ces08_idnum == 14641
replace ces08_cps_intday = 2 if ces08_idnum == 14642
replace ces08_cps_intday = 3 if ces08_idnum == 14649
replace ces08_cps_intday = 29 if ces08_idnum == 14653
replace ces08_cps_intday = 4 if ces08_idnum == 14663
replace ces08_cps_intday = 4 if ces08_idnum == 14670
replace ces08_cps_intday = 12 if ces08_idnum == 14673
replace ces08_cps_intday = 5 if ces08_idnum == 14680
replace ces08_cps_intday = 10 if ces08_idnum == 14681
replace ces08_cps_intday = 2 if ces08_idnum == 14685
replace ces08_cps_intday = 2 if ces08_idnum == 14686
replace ces08_cps_intday = 30 if ces08_idnum == 14690
replace ces08_cps_intday = 1 if ces08_idnum == 14696
replace ces08_cps_intday = 30 if ces08_idnum == 14698
replace ces08_cps_intday = 30 if ces08_idnum == 14699
replace ces08_cps_intday = 30 if ces08_idnum == 14702
replace ces08_cps_intday = 2 if ces08_idnum == 14704
replace ces08_cps_intday = 1 if ces08_idnum == 14705
replace ces08_cps_intday = 8 if ces08_idnum == 14723
replace ces08_cps_intday = 2 if ces08_idnum == 14725
replace ces08_cps_intday = 8 if ces08_idnum == 14731
replace ces08_cps_intday = 4 if ces08_idnum == 14733
replace ces08_cps_intday = 4 if ces08_idnum == 14738
replace ces08_cps_intday = 30 if ces08_idnum == 14742
replace ces08_cps_intday = 13 if ces08_idnum == 14744
replace ces08_cps_intday = 2 if ces08_idnum == 14745
replace ces08_cps_intday = 30 if ces08_idnum == 14746
replace ces08_cps_intday = 30 if ces08_idnum == 14748
replace ces08_cps_intday = 29 if ces08_idnum == 14758
replace ces08_cps_intday = 12 if ces08_idnum == 14764
replace ces08_cps_intday = 13 if ces08_idnum == 14769
replace ces08_cps_intday = 2 if ces08_idnum == 14772
replace ces08_cps_intday = 5 if ces08_idnum == 14775
replace ces08_cps_intday = 5 if ces08_idnum == 14778
replace ces08_cps_intday = 5 if ces08_idnum == 14786
replace ces08_cps_intday = 12 if ces08_idnum == 14787
replace ces08_cps_intday = 7 if ces08_idnum == 14790
replace ces08_cps_intday = 2 if ces08_idnum == 14797
replace ces08_cps_intday = 13 if ces08_idnum == 14799
replace ces08_cps_intday = 7 if ces08_idnum == 14802
replace ces08_cps_intday = 3 if ces08_idnum == 14810
replace ces08_cps_intday = 3 if ces08_idnum == 14813
replace ces08_cps_intday = 29 if ces08_idnum == 14819
replace ces08_cps_intday = 29 if ces08_idnum == 14821
replace ces08_cps_intday = 29 if ces08_idnum == 14823
replace ces08_cps_intday = 7 if ces08_idnum == 14827
replace ces08_cps_intday = 11 if ces08_idnum == 14829
replace ces08_cps_intday = 13 if ces08_idnum == 14830
replace ces08_cps_intday = 7 if ces08_idnum == 14843
replace ces08_cps_intday = 1 if ces08_idnum == 14855
replace ces08_cps_intday = 2 if ces08_idnum == 14861
replace ces08_cps_intday = 29 if ces08_idnum == 14868
replace ces08_cps_intday = 13 if ces08_idnum == 14871
replace ces08_cps_intday = 9 if ces08_idnum == 14874
replace ces08_cps_intday = 6 if ces08_idnum == 14879
replace ces08_cps_intday = 7 if ces08_idnum == 14880
replace ces08_cps_intday = 30 if ces08_idnum == 14881
replace ces08_cps_intday = 8 if ces08_idnum == 14884
replace ces08_cps_intday = 4 if ces08_idnum == 14887
replace ces08_cps_intday = 4 if ces08_idnum == 14888
replace ces08_cps_intday = 4 if ces08_idnum == 14890
replace ces08_cps_intday = 30 if ces08_idnum == 14891
replace ces08_cps_intday = 30 if ces08_idnum == 14893
replace ces08_cps_intday = 13 if ces08_idnum == 14903
replace ces08_cps_intday = 29 if ces08_idnum == 14905
replace ces08_cps_intday = 5 if ces08_idnum == 14913
replace ces08_cps_intday = 4 if ces08_idnum == 14918
replace ces08_cps_intday = 2 if ces08_idnum == 14920
replace ces08_cps_intday = 2 if ces08_idnum == 14924
replace ces08_cps_intday = 13 if ces08_idnum == 14926
replace ces08_cps_intday = 6 if ces08_idnum == 14927
replace ces08_cps_intday = 12 if ces08_idnum == 14928
replace ces08_cps_intday = 13 if ces08_idnum == 14929
replace ces08_cps_intday = 30 if ces08_idnum == 14933
replace ces08_cps_intday = 6 if ces08_idnum == 14935
replace ces08_cps_intday = 11 if ces08_idnum == 14936
replace ces08_cps_intday = 4 if ces08_idnum == 14937
replace ces08_cps_intday = 29 if ces08_idnum == 14943
replace ces08_cps_intday = 30 if ces08_idnum == 14947
replace ces08_cps_intday = 4 if ces08_idnum == 14952
replace ces08_cps_intday = 1 if ces08_idnum == 14967
replace ces08_cps_intday = 11 if ces08_idnum == 14972
replace ces08_cps_intday = 9 if ces08_idnum == 14979
replace ces08_cps_intday = 5 if ces08_idnum == 14980
replace ces08_cps_intday = 29 if ces08_idnum == 14982
replace ces08_cps_intday = 13 if ces08_idnum == 14989
replace ces08_cps_intday = 2 if ces08_idnum == 14991
replace ces08_cps_intday = 2 if ces08_idnum == 14992
replace ces08_cps_intday = 9 if ces08_idnum == 14994
replace ces08_cps_intday = 30 if ces08_idnum == 14998
replace ces08_cps_intday = 29 if ces08_idnum == 15004
replace ces08_cps_intday = 4 if ces08_idnum == 15012
replace ces08_cps_intday = 5 if ces08_idnum == 15013
replace ces08_cps_intday = 2 if ces08_idnum == 15014
replace ces08_cps_intday = 1 if ces08_idnum == 15016
replace ces08_cps_intday = 13 if ces08_idnum == 15019
replace ces08_cps_intday = 29 if ces08_idnum == 15026
replace ces08_cps_intday = 1 if ces08_idnum == 15034
replace ces08_cps_intday = 30 if ces08_idnum == 15036
replace ces08_cps_intday = 6 if ces08_idnum == 15045
replace ces08_cps_intday = 13 if ces08_idnum == 15046
replace ces08_cps_intday = 8 if ces08_idnum == 15051
replace ces08_cps_intday = 4 if ces08_idnum == 15052
replace ces08_cps_intday = 5 if ces08_idnum == 15053
replace ces08_cps_intday = 30 if ces08_idnum == 15058
replace ces08_cps_intday = 3 if ces08_idnum == 15063
replace ces08_cps_intday = 3 if ces08_idnum == 15064
replace ces08_cps_intday = 29 if ces08_idnum == 15067
replace ces08_cps_intday = 1 if ces08_idnum == 15069
replace ces08_cps_intday = 13 if ces08_idnum == 15072
replace ces08_cps_intday = 11 if ces08_idnum == 15074
replace ces08_cps_intday = 13 if ces08_idnum == 15079
replace ces08_cps_intday = 10 if ces08_idnum == 15085
replace ces08_cps_intday = 3 if ces08_idnum == 15095
replace ces08_cps_intday = 5 if ces08_idnum == 15097
replace ces08_cps_intday = 1 if ces08_idnum == 15098
replace ces08_cps_intday = 30 if ces08_idnum == 15100
replace ces08_cps_intday = 10 if ces08_idnum == 15112
replace ces08_cps_intday = 1 if ces08_idnum == 15120
replace ces08_cps_intday = 6 if ces08_idnum == 15128
replace ces08_cps_intday = 29 if ces08_idnum == 15137
replace ces08_cps_intday = 5 if ces08_idnum == 15139
replace ces08_cps_intday = 6 if ces08_idnum == 15147
replace ces08_cps_intday = 29 if ces08_idnum == 15148
replace ces08_cps_intday = 5 if ces08_idnum == 15156
replace ces08_cps_intday = 1 if ces08_idnum == 15160
replace ces08_cps_intday = 5 if ces08_idnum == 15166
replace ces08_cps_intday = 8 if ces08_idnum == 15172
replace ces08_cps_intday = 13 if ces08_idnum == 15182
replace ces08_cps_intday = 8 if ces08_idnum == 15183
replace ces08_cps_intday = 13 if ces08_idnum == 15188
replace ces08_cps_intday = 4 if ces08_idnum == 15190
replace ces08_cps_intday = 7 if ces08_idnum == 15192
replace ces08_cps_intday = 11 if ces08_idnum == 15194
replace ces08_cps_intday = 3 if ces08_idnum == 15213
replace ces08_cps_intday = 9 if ces08_idnum == 15221
replace ces08_cps_intday = 1 if ces08_idnum == 15224
replace ces08_cps_intday = 3 if ces08_idnum == 15236
replace ces08_cps_intday = 10 if ces08_idnum == 15245
replace ces08_cps_intday = 11 if ces08_idnum == 15254
replace ces08_cps_intday = 1 if ces08_idnum == 15257
replace ces08_cps_intday = 1 if ces08_idnum == 15258
replace ces08_cps_intday = 10 if ces08_idnum == 15264
replace ces08_cps_intday = 5 if ces08_idnum == 15272
replace ces08_cps_intday = 1 if ces08_idnum == 15273
replace ces08_cps_intday = 13 if ces08_idnum == 15274
replace ces08_cps_intday = 11 if ces08_idnum == 15276
replace ces08_cps_intday = 11 if ces08_idnum == 15279
replace ces08_cps_intday = 1 if ces08_idnum == 15287
replace ces08_cps_intday = 12 if ces08_idnum == 15288
replace ces08_cps_intday = 10 if ces08_idnum == 15295
replace ces08_cps_intday = 1 if ces08_idnum == 15297
replace ces08_cps_intday = 13 if ces08_idnum == 15307
replace ces08_cps_intday = 1 if ces08_idnum == 15309
replace ces08_cps_intday = 1 if ces08_idnum == 15312
replace ces08_cps_intday = 5 if ces08_idnum == 15321
replace ces08_cps_intday = 1 if ces08_idnum == 15322
replace ces08_cps_intday = 2 if ces08_idnum == 15324
replace ces08_cps_intday = 2 if ces08_idnum == 15325
replace ces08_cps_intday = 1 if ces08_idnum == 15337
replace ces08_cps_intday = 4 if ces08_idnum == 15340
replace ces08_cps_intday = 1 if ces08_idnum == 15344
replace ces08_cps_intday = 2 if ces08_idnum == 15346
replace ces08_cps_intday = 1 if ces08_idnum == 15347
replace ces08_cps_intday = 1 if ces08_idnum == 15349
replace ces08_cps_intday = 1 if ces08_idnum == 15358
replace ces08_cps_intday = 8 if ces08_idnum == 15359
replace ces08_cps_intday = 10 if ces08_idnum == 15361
replace ces08_cps_intday = 9 if ces08_idnum == 15369
replace ces08_cps_intday = 11 if ces08_idnum == 15377
replace ces08_cps_intday = 13 if ces08_idnum == 15380
replace ces08_cps_intday = 1 if ces08_idnum == 15384
replace ces08_cps_intday = 1 if ces08_idnum == 15390
replace ces08_cps_intday = 6 if ces08_idnum == 15395
replace ces08_cps_intday = 12 if ces08_idnum == 15397
replace ces08_cps_intday = 11 if ces08_idnum == 15408
replace ces08_cps_intday = 4 if ces08_idnum == 15409
replace ces08_cps_intday = 13 if ces08_idnum == 15414
replace ces08_cps_intday = 3 if ces08_idnum == 15418
replace ces08_cps_intday = 11 if ces08_idnum == 15423
replace ces08_cps_intday = 12 if ces08_idnum == 15427
replace ces08_cps_intday = 7 if ces08_idnum == 15430
replace ces08_cps_intday = 7 if ces08_idnum == 15436
replace ces08_cps_intday = 9 if ces08_idnum == 15437
replace ces08_cps_intday = 8 if ces08_idnum == 15440
replace ces08_cps_intday = 3 if ces08_idnum == 15446
replace ces08_cps_intday = 3 if ces08_idnum == 15449
replace ces08_cps_intday = 6 if ces08_idnum == 15450
replace ces08_cps_intday = 5 if ces08_idnum == 15453
replace ces08_cps_intday = 3 if ces08_idnum == 15455
replace ces08_cps_intday = 3 if ces08_idnum == 15464
replace ces08_cps_intday = 12 if ces08_idnum == 15469
replace ces08_cps_intday = 3 if ces08_idnum == 15470
replace ces08_cps_intday = 6 if ces08_idnum == 15472
replace ces08_cps_intday = 10 if ces08_idnum == 15474
replace ces08_cps_intday = 3 if ces08_idnum == 15477
replace ces08_cps_intday = 3 if ces08_idnum == 15479
replace ces08_cps_intday = 3 if ces08_idnum == 15481
replace ces08_cps_intday = 5 if ces08_idnum == 15482
replace ces08_cps_intday = 11 if ces08_idnum == 15483
replace ces08_cps_intday = 5 if ces08_idnum == 15484
replace ces08_cps_intday = 13 if ces08_idnum == 15485
replace ces08_cps_intday = 13 if ces08_idnum == 15488
replace ces08_cps_intday = 5 if ces08_idnum == 15491
replace ces08_cps_intday = 13 if ces08_idnum == 15492
replace ces08_cps_intday = 12 if ces08_idnum == 15496
replace ces08_cps_intday = 11 if ces08_idnum == 15502
replace ces08_cps_intday = 3 if ces08_idnum == 15505
replace ces08_cps_intday = 3 if ces08_idnum == 15508
replace ces08_cps_intday = 13 if ces08_idnum == 15509
replace ces08_cps_intday = 9 if ces08_idnum == 15511
replace ces08_cps_intday = 10 if ces08_idnum == 15514
replace ces08_cps_intday = 4 if ces08_idnum == 15516
replace ces08_cps_intday = 3 if ces08_idnum == 15517
replace ces08_cps_intday = 3 if ces08_idnum == 15518
replace ces08_cps_intday = 7 if ces08_idnum == 15519
replace ces08_cps_intday = 11 if ces08_idnum == 15528
replace ces08_cps_intday = 12 if ces08_idnum == 15531
replace ces08_cps_intday = 3 if ces08_idnum == 15533
replace ces08_cps_intday = 9 if ces08_idnum == 15536
replace ces08_cps_intday = 10 if ces08_idnum == 15538
replace ces08_cps_intday = 3 if ces08_idnum == 15539
replace ces08_cps_intday = 3 if ces08_idnum == 15541
replace ces08_cps_intday = 3 if ces08_idnum == 15545
replace ces08_cps_intday = 8 if ces08_idnum == 15548
replace ces08_cps_intday = 4 if ces08_idnum == 15553
replace ces08_cps_intday = 3 if ces08_idnum == 15556
replace ces08_cps_intday = 11 if ces08_idnum == 15557
replace ces08_cps_intday = 10 if ces08_idnum == 15580
replace ces08_cps_intday = 13 if ces08_idnum == 15581
replace ces08_cps_intday = 12 if ces08_idnum == 15582
replace ces08_cps_intday = 4 if ces08_idnum == 15587
replace ces08_cps_intday = 5 if ces08_idnum == 15590
replace ces08_cps_intday = 11 if ces08_idnum == 15595
replace ces08_cps_intday = 12 if ces08_idnum == 15596
replace ces08_cps_intday = 5 if ces08_idnum == 15597
replace ces08_cps_intday = 13 if ces08_idnum == 15599
replace ces08_cps_intday = 4 if ces08_idnum == 15600
replace ces08_cps_intday = 12 if ces08_idnum == 15605
replace ces08_cps_intday = 4 if ces08_idnum == 15607
replace ces08_cps_intday = 4 if ces08_idnum == 15608
replace ces08_cps_intday = 3 if ces08_idnum == 15616
replace ces08_cps_intday = 3 if ces08_idnum == 15618
replace ces08_cps_intday = 8 if ces08_idnum == 15620
replace ces08_cps_intday = 12 if ces08_idnum == 15628
replace ces08_cps_intday = 12 if ces08_idnum == 15632
replace ces08_cps_intday = 13 if ces08_idnum == 15635
replace ces08_cps_intday = 7 if ces08_idnum == 15640
replace ces08_cps_intday = 5 if ces08_idnum == 15647
replace ces08_cps_intday = 5 if ces08_idnum == 15648
replace ces08_cps_intday = 3 if ces08_idnum == 15650
replace ces08_cps_intday = 8 if ces08_idnum == 15652
replace ces08_cps_intday = 6 if ces08_idnum == 15653
replace ces08_cps_intday = 9 if ces08_idnum == 15655
replace ces08_cps_intday = 6 if ces08_idnum == 15658
replace ces08_cps_intday = 7 if ces08_idnum == 15660
replace ces08_cps_intday = 6 if ces08_idnum == 15664
replace ces08_cps_intday = 12 if ces08_idnum == 15668
replace ces08_cps_intday = 12 if ces08_idnum == 15672
replace ces08_cps_intday = 12 if ces08_idnum == 15676
replace ces08_cps_intday = 9 if ces08_idnum == 15690
replace ces08_cps_intday = 10 if ces08_idnum == 15701
replace ces08_cps_intday = 12 if ces08_idnum == 15725
replace ces08_cps_intday = 6 if ces08_idnum == 15728
replace ces08_cps_intday = 6 if ces08_idnum == 15729
replace ces08_cps_intday = 13 if ces08_idnum == 15734
replace ces08_cps_intday = 13 if ces08_idnum == 15735
replace ces08_cps_intday = 12 if ces08_idnum == 15736
replace ces08_cps_intday = 11 if ces08_idnum == 15741
replace ces08_cps_intday = 6 if ces08_idnum == 15750
replace ces08_cps_intday = 7 if ces08_idnum == 15758
replace ces08_cps_intday = 6 if ces08_idnum == 15760
replace ces08_cps_intday = 6 if ces08_idnum == 15762
replace ces08_cps_intday = 9 if ces08_idnum == 15765
replace ces08_cps_intday = 8 if ces08_idnum == 15771
replace ces08_cps_intday = 13 if ces08_idnum == 15774
replace ces08_cps_intday = 6 if ces08_idnum == 15778
replace ces08_cps_intday = 12 if ces08_idnum == 15788
replace ces08_cps_intday = 8 if ces08_idnum == 15789
replace ces08_cps_intday = 12 if ces08_idnum == 15794
replace ces08_cps_intday = 13 if ces08_idnum == 15796
replace ces08_cps_intday = 7 if ces08_idnum == 15797
replace ces08_cps_intday = 12 if ces08_idnum == 15800
replace ces08_cps_intday = 6 if ces08_idnum == 15808
replace ces08_cps_intday = 11 if ces08_idnum == 15815
replace ces08_cps_intday = 6 if ces08_idnum == 15828
replace ces08_cps_intday = 9 if ces08_idnum == 15844
replace ces08_cps_intday = 6 if ces08_idnum == 15845
replace ces08_cps_intday = 11 if ces08_idnum == 15847
replace ces08_cps_intday = 6 if ces08_idnum == 15848
replace ces08_cps_intday = 13 if ces08_idnum == 15850
replace ces08_cps_intday = 8 if ces08_idnum == 15852
replace ces08_cps_intday = 7 if ces08_idnum == 15854
replace ces08_cps_intday = 8 if ces08_idnum == 15857
replace ces08_cps_intday = 6 if ces08_idnum == 15860
replace ces08_cps_intday = 13 if ces08_idnum == 15867
replace ces08_cps_intday = 6 if ces08_idnum == 15877
replace ces08_cps_intday = 6 if ces08_idnum == 15890
replace ces08_cps_intday = 8 if ces08_idnum == 15894
replace ces08_cps_intday = 7 if ces08_idnum == 15896
replace ces08_cps_intday = 9 if ces08_idnum == 15898
replace ces08_cps_intday = 13 if ces08_idnum == 15900

gen CA08_surveydate = mdy(ces08_cps_intmonth,ces08_cps_intday,ces08_cps_intyear) // Interview date

format %tdMon_DD,_CCYY CA08_surveydate // Format interview date: DDMMYYYY

gen CA08_edate = 20081014 // Election date

gen CA08_electiondate = date(string(CA08_edate,"%8.0f"),"YMD")

format %tdMon_DD,_CCYY CA08_electiondate // Format election date: DDMMYYYY

gen CA08_time = CA08_electiondate - CA08_surveydate // Number of days between interview and election

* Gender

gen CA08_male = gender // Gender

recode CA08_male (5=0) // Recode female = 0

* Age

gen CA08_yearofbirth = yearofbirth // Year of birth

recode CA08_yearofbirth (9998=.) // Recode "don't know" as missing data
recode CA08_yearofbirth (9999=.) // Recode "refused" as missing data

gen CA08_age = 2008 - CA08_yearofbirth // Age

replace CA08_age = . if CA08_age < 17 // Recode respondents less than 17 years old as missing data

* Name of NDP leader - Correct answer (Jack Layton) = 1, Incorrect answer = 0

gen CA08_ndpleader = ces08_cps_e1 // NDP leader

recode CA08_ndpleader (5=0) // Recode "any other answer" as incorrect answer
recode CA08_ndpleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA08_ndpleader (8=0) // Recode "don't know" as incorrect answer
recode CA08_ndpleader (9=.) // Recode "refused" as missing data

* Name of Conservative leader - Correct answer (Stepehn Harper) = 1, Incorrect answer = 0

gen CA08_cpcleader = ces08_cps_e2 // Conservative leader

recode CA08_cpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA08_cpcleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA08_cpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA08_cpcleader (9=.) // Recode "refused" as missing data

* Name of Liberal leader - Correct answer (Stéphane Dion) = 1, Incorrect answer = 0

gen CA08_lpcleader = ces08_cps_e4 // Liberal leader

recode CA08_lpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA08_lpcleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA08_lpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA08_lpcleader (9=.) // Recode "refused" as missing data

* Name of Green leader - Correct answer (Elizabeth May) = 1, Incorrect answer = 0

gen CA08_gpcleader = ces08_cps_e5 // Green leader

recode CA08_gpcleader (5=0) // Recode "any other answer" as incorrect answer
recode CA08_gpcleader (7=0) // Recode "R volunteers do not know any leaders" as incorrect answer
recode CA08_gpcleader (8=0) // Recode "don't know" as incorrect answer
recode CA08_gpcleader (9=.) // Recode "refused" as missing data

* Name of the Republican running for president of the United States - Correct answer (John McCain) = 1, Incorrect answer = 0

gen CA08_republican = ces08_cps_know_1 // Republican candidate

recode CA08_republican (5=0) // Recode "any other name" as incorrect answer
recode CA08_republican (8=0) // Recode "don't know" as incorrect answer
recode CA08_republican (9=.) // Recode "refused" as missing data

* Name of the provincial premier - Correct answer (Danny Williams in Newfoundland, Robert Ghiz in Prince Edward Island, Rodney MacDonald in Nova Scotia, Shawn Graham in New Brunswick, Jean Charest in Quebec, Dalton McGuinty in Ontario, Gary Doer in Manitoba, Brad Hall in Saskatchewan, Ed Stelmach in Alberta, Gordon Campbell in British Columbia) = 1, Incorrect answer = 0

gen CA08_premier = ces08_cps_know_2 // Porvincial premier

recode CA08_premier (10=1) if ces08_province == 10 // Premier of Newfoundland: correct answer
recode CA08_premier (11=1) if ces08_province == 11 // Premier of Prince Edward Island: correct answer
recode CA08_premier (12=1) if ces08_province == 12 // Premier of Nova Scotia: correct answer
recode CA08_premier (13=1) if ces08_province == 13 // Premier of New Brunswick: correct answer
recode CA08_premier (24=1) if ces08_province == 24 // Premier of Quebec: correct answer
recode CA08_premier (35=1) if ces08_province == 35 // Premier of Ontario: correct answer
recode CA08_premier (46=1) if ces08_province == 46 // Premier of Manitoba: correct answer
recode CA08_premier (47=1) if ces08_province == 47 // Premier of Saskatchewan: correct answer
recode CA08_premier (48=1) if ces08_province == 48 // Premier of Alberta: correct answer
recode CA08_premier (59=1) if ces08_province == 59 // Premier of British Columbia: correct answer
recode CA08_premier (97=0) // Recode "any other name" as incorrect answer
recode CA08_premier (98=0) // Recode "don't know" as incorrect answer
recode CA08_premier (99=.) // Recode "refused" as missing data

recode CA08_premier (10=0) if ces08_province!=10 & CA08_premier!=. // Premier of Newfoundland: incorrect answer
recode CA08_premier (11=0) if ces08_province!=11 & CA08_premier!=. // Premier of Prince Edward Island: incorrect answer
recode CA08_premier (12=0) if ces08_province!=12 & CA08_premier!=. // Premier of Nova Scotia: incorrect answer
recode CA08_premier (13=0) if ces08_province!=13 & CA08_premier!=. // Premier of New Brunswick: incorrect answer
recode CA08_premier (24=0) if ces08_province!=24 & CA08_premier!=. // Premier of Quebec: incorrect answer
recode CA08_premier (35=0) if ces08_province!=35 & CA08_premier!=. // Premier of Ontario: incorrect answer
recode CA08_premier (46=0) if ces08_province!=46 & CA08_premier!=. // Premier of Manitoba: incorrect answer
recode CA08_premier (47=0) if ces08_province!=47 & CA08_premier!=. // Premier of Saskatchewan: incorrect answer
recode CA08_premier (48=0) if ces08_province!=48 & CA08_premier!=. // Premier of Alberta: incorrect answer
recode CA08_premier (59=0) if ces08_province!=59 & CA08_premier!=. // Premier of British Columbia: incorrect answer

* Name of a Cabinet Minister in the federal government - Correct answer (Beverly Oda, Christian Paradis, Chuck Strahl, David Emerson, Diane Finley, Gary Lunn, Gerry Ritz, Gordon O'Connor, Greg Thompson, Helena Guergis, Jason Kenney, Jean-Pierre Blackburn, Jim Flaherty, Jim Prentice, John Baird, Josée Verner, Lawrence Cannon, Loyola Hearn, Marjory LeBreton, Michael Fortier, Monte Solberg, Peter Mackay, Peter Van Loan, Rona Ambrose, Rob Nicholson, Stockwell Day, Tony Clement, Vic Toews) = 1, Incorrect answer = 0

gen CA08_minister = ces08_cps_know_3 // Cabinet Minister

replace CA08_minister = 1 if CA08_minister < 30

recode CA08_minister (30=0) // Recode "any other name" as incorrect answer
recode CA08_minister (98=0) // Recode "don't know" as incorrect answer
recode CA08_minister (99=.) // Recode "refused" as missing data

* Name of the Governor-General of Canada - Correct answer (Michaëlle Jean) = 1, Incorrect answer = 0

gen CA08_govgeneral = ces08_cps_know_4 // Governor-General of Canada

recode CA08_govgeneral (3=0) // Recode "think R means Michaëlle Jean" as incorrect answer
recode CA08_govgeneral (5=0) // Recode "any other name" as incorrect answer
recode CA08_govgeneral (8=0) // Recode "don't know" as incorrect answer
recode CA08_govgeneral (9=.) // Recode "refused" as missing data

* Political knowledge index

gen CA08_knowledge = CA08_ndpleader + CA08_cpcleader + CA08_lpcleader + CA08_gpcleader + CA08_republican + CA08_premier + CA08_minister + CA08_govgeneral // Political knowledge index

* Political discussion (post) #1

gen CA08_discussion1 = ces08_pes_a9

recode CA08_discussion1 (8=.)
recode CA08_discussion1 (9=.)

replace CA08_discussion1 = 30 if CA08_discussion1 == 1
replace CA08_discussion1 = 20 if CA08_discussion1 == 3
replace CA08_discussion1 = 10 if CA08_discussion1 == 5

replace CA08_discussion1 = 2 if CA08_discussion1 == 30
replace CA08_discussion1 = 1 if CA08_discussion1 == 20
replace CA08_discussion1 = 0 if CA08_discussion1 == 10

* Political discussion (post) #2

gen CA08_discussion2_family = ces08_pes_ec6
gen CA08_discussion2_friends = ces08_pes_ec7

recode CA08_discussion2_family CA08_discussion2_friends (8=.)
recode CA08_discussion2_family CA08_discussion2_friends (9=.)

replace CA08_discussion2_family = 40 if CA08_discussion2_family == 1
replace CA08_discussion2_family = 30 if CA08_discussion2_family == 3
replace CA08_discussion2_family = 20 if CA08_discussion2_family == 5
replace CA08_discussion2_family = 10 if CA08_discussion2_family == 7

replace CA08_discussion2_family = 3 if CA08_discussion2_family == 40
replace CA08_discussion2_family = 2 if CA08_discussion2_family == 30
replace CA08_discussion2_family = 1 if CA08_discussion2_family == 20
replace CA08_discussion2_family = 0 if CA08_discussion2_family == 10

replace CA08_discussion2_friends = 40 if CA08_discussion2_friends == 1
replace CA08_discussion2_friends = 30 if CA08_discussion2_friends == 3
replace CA08_discussion2_friends = 20 if CA08_discussion2_friends == 5
replace CA08_discussion2_friends = 10 if CA08_discussion2_friends == 7

replace CA08_discussion2_friends = 3 if CA08_discussion2_friends == 40
replace CA08_discussion2_friends = 2 if CA08_discussion2_friends == 30
replace CA08_discussion2_friends = 1 if CA08_discussion2_friends == 20
replace CA08_discussion2_friends = 0 if CA08_discussion2_friends == 10

gen CA08_discussion2 = CA08_discussion2_family + CA08_discussion2_friends

gen CA08_discussion2_family_3pts = CA08_discussion2_family
replace CA08_discussion2_family_3pts = 0 if CA08_discussion2_family == 1
replace CA08_discussion2_family_3pts = 1 if CA08_discussion2_family == 2
replace CA08_discussion2_family_3pts = 2 if CA08_discussion2_family == 3

gen CA08_discussion2_friends_3pts = CA08_discussion2_friends
replace CA08_discussion2_friends_3pts = 0 if CA08_discussion2_friends == 1
replace CA08_discussion2_friends_3pts = 1 if CA08_discussion2_friends == 2
replace CA08_discussion2_friends_3pts = 2 if CA08_discussion2_friends == 3

egen CA08_discussion2_3pts = rowmax(CA08_discussion2_friends_3pts CA08_discussion2_friends_3pts)

* Network size

gen CA08_size = ces08_mbs_c1

recode CA08_size (-9=.)

replace CA08_size = . if CA08_size >= 999

gen CA08_size_3pts = CA08_size
replace CA08_size_3pts = 0 if CA08_size == 1
replace CA08_size_3pts = 1 if CA08_size == 2
replace CA08_size_3pts = 1 if CA08_size == 3
replace CA08_size_3pts = 1 if CA08_size == 4
replace CA08_size_3pts = 2 if CA08_size > 4 & CA08_size!=.

* Social contact 

gen CA08_contact = ces08_mbs_c2

recode CA08_contact (-9=.)

replace CA08_contact = 5 - CA08_contact

replace CA08_contact = 0 if CA08_size == 0

* Diversity

gen CA08_same_sex = ces08_mbs_c3a
gen CA08_same_age = ces08_mbs_c3b
gen CA08_same_education = ces08_mbs_c3c
gen CA08_same_income = ces08_mbs_c3d
gen CA08_same_race = ces08_mbs_c3e

recode CA08_same_sex CA08_same_age CA08_same_education CA08_same_income CA08_same_race (-9=.)

replace CA08_same_sex = 3 - CA08_same_sex

replace CA08_same_age = 3 - CA08_same_age

replace CA08_same_education = 3 - CA08_same_education

replace CA08_same_income = 3 - CA08_same_income

replace CA08_same_race = 3 - CA08_same_race

gen CA08_diversity_complete = 1 if CA08_same_sex!=. & CA08_same_age!=. & CA08_same_education!=. & CA08_same_income!=. & CA08_same_race!=.

gen CA08_diversity = CA08_same_sex + CA08_same_age + CA08_same_education + CA08_same_income + CA08_same_race if CA08_diversity_complete == 1

* Main source of information

gen CA08_network_main = 1 if ces08_pes_a3 == 5 | ces08_pes_a3 == 6

replace CA08_network_main = 0 if ces08_pes_a3!=5 & ces08_pes_a3!=6
replace CA08_network_main = . if ces08_pes_a3 == 8
replace CA08_network_main = . if ces08_pes_a3 == 9


********************************************************
** NATIONAL-LEVEL EXPECTATIONS: 2004 FEDERAL ELECTION **
********************************************************

* Generate variable identifying incomplete answers

gen CA04_lpc_chance_whole = ces04_cps_chance4
gen CA04_cpc_chance_whole = ces04_cps_chance5
gen CA04_ndp_chance_whole = ces04_cps_chance6

recode CA04_lpc_chance_whole CA04_cpc_chance_whole CA04_ndp_chance_whole (995=0)
recode CA04_lpc_chance_whole CA04_cpc_chance_whole CA04_ndp_chance_whole (996=100)
recode CA04_lpc_chance_whole CA04_cpc_chance_whole CA04_ndp_chance_whole (997=.)
recode CA04_lpc_chance_whole CA04_cpc_chance_whole CA04_ndp_chance_whole (998=.)
recode CA04_lpc_chance_whole CA04_cpc_chance_whole CA04_ndp_chance_whole (999=.)

gen CA04_complete_whole = 1 if CA04_lpc_chance_whole!=. & CA04_cpc_chance_whole!=. & CA04_ndp_chance_whole!=.

* Generate value of 1 if the expectation for one party is higher or equal to the expectations for at least one other party

gen CA04_lpc_whole = 1 if CA04_lpc_chance_whole >= CA04_cpc_chance_whole & CA04_lpc_chance_whole >= CA04_ndp_chance_whole & CA04_complete_whole == 1
gen CA04_cpc_whole = 1 if CA04_cpc_chance_whole >= CA04_lpc_chance_whole & CA04_cpc_chance_whole >= CA04_ndp_chance_whole & CA04_complete_whole == 1
gen CA04_ndp_whole = 1 if CA04_ndp_chance_whole >= CA04_lpc_chance_whole & CA04_ndp_chance_whole >= CA04_cpc_chance_whole & CA04_complete_whole == 1
gen CA04_oth_whole = 1 if CA04_lpc_chance_whole == 0 & CA04_cpc_chance_whole == 0 & CA04_ndp_chance_whole == 0

replace CA04_lpc_whole = . if CA04_oth_whole == 1 & CA04_complete_whole == 1
replace CA04_cpc_whole = . if CA04_oth_whole == 1 & CA04_complete_whole == 1
replace CA04_ndp_whole = . if CA04_oth_whole == 1 & CA04_complete_whole == 1

* Generate variable for ambiguous forecasts

gen CA04_ambiguous_whole = .

replace CA04_ambiguous_whole = 99 if CA04_lpc_whole == CA04_cpc_whole & CA04_lpc_whole!=. & CA04_complete_whole == 1 | CA04_lpc_whole == CA04_ndp_whole & CA04_lpc_whole!=. & CA04_complete_whole == 1
replace CA04_ambiguous_whole = 99 if CA04_cpc_whole == CA04_lpc_whole & CA04_cpc_whole!=. & CA04_complete_whole == 1 | CA04_cpc_whole == CA04_ndp_whole & CA04_cpc_whole!=. & CA04_complete_whole == 1
replace CA04_ambiguous_whole = 99 if CA04_ndp_whole == CA04_lpc_whole & CA04_ndp_whole!=. & CA04_complete_whole == 1 | CA04_ndp_whole == CA04_cpc_whole & CA04_ndp_whole!=. & CA04_complete_whole == 1

* Generate value of 0 for lower expectations

replace CA04_lpc_whole = 0 if CA04_lpc_whole!=1 & CA04_complete_whole == 1
replace CA04_cpc_whole = 0 if CA04_cpc_whole!=1 & CA04_complete_whole == 1
replace CA04_ndp_whole = 0 if CA04_ndp_whole!=1 & CA04_complete_whole == 1
replace CA04_oth_whole = 0 if CA04_oth_whole!=1 & CA04_complete_whole == 1

* Forecasts (1 = Liberal, 2 = Conservative, 3 = NDP, 4 = BQ, 88 = other, 99 = ambiguous)

gen CA04_forecast_whole = .

replace CA04_forecast_whole = 1 if CA04_lpc_whole == 1 & CA04_complete_whole == 1
replace CA04_forecast_whole = 2 if CA04_cpc_whole == 1 & CA04_complete_whole == 1
replace CA04_forecast_whole = 3 if CA04_ndp_whole == 1 & CA04_complete_whole == 1
replace CA04_forecast_whole = 88 if CA04_oth_whole == 1 & CA04_complete_whole == 1
replace CA04_forecast_whole = 99 if CA04_ambiguous_whole == 99 & CA04_complete_whole == 1

* Identify correct and ambiguous forecasts

gen CA04_correct_whole = 0 if CA04_forecast_whole!=1 & CA04_forecast_whole!=99 & CA04_complete_whole == 1
replace CA04_correct_whole = 1 if CA04_forecast_whole == 1 & CA04_forecast_whole!=99 & CA04_complete_whole == 1

replace CA04_correct_whole = 0 if CA04_forecast_whole == 99 & CA04_lpc_whole!=1 & CA04_complete_whole == 1

replace CA04_correct_whole = 0 if ces04_cps_chance4 == 998 & ces04_cps_chance5 == 998 & ces04_cps_chance6 == 998

replace CA04_correct_whole = 99 if CA04_forecast_whole == 99 & CA04_lpc_whole == 1 & CA04_complete_whole == 1

* Generate dichotomous variable (treat ambiguous forecasts as incorrect)

gen CA04_correct_whole_d = CA04_correct_whole

replace CA04_correct_whole_d = 0 if CA04_correct_whole_d == 99
replace CA04_correct_whole_d = 1 if CA04_correct_whole_d == 1


********************************************************
** DISTRICT-LEVEL EXPECTATIONS: 2004 FEDERAL ELECTION **
********************************************************

* Generate winning probability variable (BQ in Quebec only)

gen CA04_lpc_chance_district = ces04_cps_chance11 // LPC candidate's probability of winning in district
gen CA04_bq_chance_district = ces04_cps_chance12 // BQ candidate's probability of winning in district
gen CA04_cpc_chance_district = ces04_cps_chance13 // CPC candidate's probability of winning in district
gen CA04_ndp_chance_district = ces04_cps_chance14 // NDP candidate's probability of winning in district

gen CA04_no_forecast_district = 1 if CA04_lpc_chance_district == . & CA04_bq_chance_district == . & CA04_cpc_chance_district == . & CA04_ndp_chance_district == . & ces04_province == 24 | CA04_lpc_chance_district == . & CA04_cpc_chance_district == . & CA04_ndp_chance_district == . & ces04_province!=24 | CA04_lpc_chance_district == 997 & CA04_bq_chance_district == 997 & CA04_cpc_chance_district == 997 & CA04_ndp_chance_district == 997 & ces04_province == 24 | CA04_lpc_chance_district == 997 & CA04_cpc_chance_district == 997 & CA04_ndp_chance_district == 997 & ces04_province!=24 // The respondent did not make any forecast

gen CA04_dk_forecast_district = 1 if CA04_lpc_chance_district == 998 & CA04_bq_chance_district == 998 & CA04_cpc_chance_district == 998 & CA04_ndp_chance_district & ces04_province == 24 | CA04_lpc_chance_district == 998 & CA04_cpc_chance_district == 998 & CA04_ndp_chance_district & ces04_province == 24 // The respondent answered "don't know" for every candidate

recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (995=0) // Imputed 0 (995) recoded as 0
recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (996=100) // Imputed 100 (996) recoded as 100
recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (997=.) // Recode "not asked" as missing data
recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (998=.) // Recode "don't know" as missing data
recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (999=.) 

recode CA04_lpc_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (.=0) if CA04_lpc_chance_district!=. & ces04_province == 24 | CA04_bq_chance_district!=. & ces04_province == 24 | CA04_cpc_chance_district!=. & ces04_province == 24 | CA04_ndp_chance_district!=. & ces04_province == 24 // Replace missing data by expectation score of 0 (unless the respondent provided no expectation score)

recode CA04_lpc_chance_district CA04_bq_chance_district CA04_cpc_chance_district CA04_ndp_chance_district (.=0) if CA04_lpc_chance_district!=. & ces04_province!=24 | CA04_cpc_chance_district!=. & ces04_province!=24 | CA04_ndp_chance_district!=. & ces04_province!=24 // Replace missing data by expectation score of 0 (unless the respondent provided no expectation score)

gen CA04_complete_district_qc = 1 if CA04_lpc_chance_district!=. & CA04_bq_chance_district!=. & CA04_cpc_chance_district!=. & CA04_ndp_chance_district!=. & ces04_province == 24 // If the respondent gave an expectation score to each party candidate, treat his/her answers as complete (Quebec respondents)

gen CA04_complete_district_roc = 1 if CA04_lpc_chance_district!=. & CA04_cpc_chance_district!=. & CA04_ndp_chance_district!=. & ces04_province!=24 // If the respondent gave an expectation score to each party candidate, treat his/her answers as complete (ROC respondents)

gen CA04_complete_district = max(CA04_complete_district_qc, CA04_complete_district_roc) // If the respondent gave an expectation score to each party candidate, treat his/her answers as complete

* Generate value of 1 if the expectation for one candidate is higher or equal to the expectations for at least one other candidate

gen CA04_lpc_district_qc = 1 if CA04_lpc_chance_district >= CA04_bq_chance_district & CA04_lpc_chance_district >= CA04_cpc_chance_district & CA04_lpc_chance_district >= CA04_ndp_chance_district & ces04_province == 24 & CA04_complete_district == 1 // The LPC candidate received the highest expectation score given by the respondent
gen CA04_bq_district_qc = 1 if CA04_bq_chance_district >= CA04_lpc_chance_district & CA04_bq_chance_district >= CA04_cpc_chance_district & CA04_bq_chance_district >= CA04_ndp_chance_district & ces04_province == 24 & CA04_complete_district == 1 // The BQ candidate received the highest expectation score given by the respondent
gen CA04_cpc_district_qc = 1 if CA04_cpc_chance_district >= CA04_lpc_chance_district & CA04_cpc_chance_district >= CA04_bq_chance_district & CA04_cpc_chance_district >= CA04_ndp_chance_district & ces04_province == 24 & CA04_complete_district == 1 // The CPC candidate received the highest expectation score given by the respondent
gen CA04_ndp_district_qc = 1 if CA04_ndp_chance_district >= CA04_lpc_chance_district & CA04_ndp_chance_district >= CA04_bq_chance_district & CA04_ndp_chance_district >= CA04_cpc_chance_district & ces04_province == 24 & CA04_complete_district == 1 // The NDP candidate received the highest expectation score given by the respondent
gen CA04_oth_district_qc = 1 if CA04_lpc_chance_district == 0 & CA04_bq_chance_district == 0 & CA04_cpc_chance_district == 0 & CA04_ndp_chance_district == 0 & ces04_province == 24 & CA04_complete_district == 1 // Another candidate received the highest expectation score given by the respondent (if a respondent gave a score of 0 to every party candidate, it is assumed that the respondent believes some other party has the highest chance of winning in the district)

gen CA04_lpc_district_roc = 1 if CA04_lpc_chance_district >= CA04_cpc_chance_district & CA04_lpc_chance_district >= CA04_ndp_chance_district & ces04_province!=24 & CA04_complete_district == 1 // The LPC candidate received the highest expectation score given by the respondent
gen CA04_cpc_district_roc = 1 if CA04_cpc_chance_district >= CA04_lpc_chance_district & CA04_cpc_chance_district >= CA04_ndp_chance_district & ces04_province!=24 & CA04_complete_district == 1 // The CPC candidate received the highest expectation score given by the respondent
gen CA04_ndp_district_roc = 1 if CA04_ndp_chance_district >= CA04_lpc_chance_district & CA04_ndp_chance_district >= CA04_cpc_chance_district & ces04_province!=24 & CA04_complete_district == 1 // The NDP candidate received the highest expectation score given by the respondent
gen CA04_oth_district_roc = 1 if CA04_lpc_chance_district == 0 & CA04_cpc_chance_district == 0 & CA04_ndp_chance_district == 0 & ces04_province!=24 & CA04_complete_district == 1 // Another candidate received the highest expectation score given by the respondent (if a respondent gave a score of 0 to every party candidate, it is assumed that the respondent believes some other party has the highest chance of winning in the district)

gen CA04_lpc_district = max(CA04_lpc_district_qc,CA04_lpc_district_roc) 
gen CA04_bq_district = CA04_bq_district_qc 
gen CA04_cpc_district = max(CA04_cpc_district_qc,CA04_cpc_district_roc) 
gen CA04_ndp_district = max(CA04_ndp_district_qc,CA04_ndp_district_roc) 
gen CA04_oth_district = max(CA04_oth_district_qc,CA04_oth_district_roc) // Merging answers from Quebec respondents and ROC respondents

replace CA04_lpc_district = . if CA04_oth_district == 1 
replace CA04_bq_district = . if CA04_oth_district == 1 
replace CA04_cpc_district = . if CA04_oth_district == 1 
replace CA04_ndp_district = . if CA04_oth_district == 1 // This ensures respondents who gave a score of 0 to every party candidate are not treated as providing ambiguous forecasts

* Generate variable for ambiguous forecasts

gen CA04_forecast_ambiguous_district = .

replace CA04_forecast_ambiguous_district = 99 if CA04_lpc_district == CA04_bq_district & CA04_lpc_district!=. & CA04_complete_district == 1 | CA04_lpc_district == CA04_cpc_district& CA04_lpc_district!=. & CA04_complete_district == 1 | CA04_lpc_district == CA04_ndp_district & CA04_lpc_district!=. & CA04_complete_district == 1 // The respondent gave his/her highest expectation score to the LPC candidate and at least one other candidate
replace CA04_forecast_ambiguous_district = 99 if CA04_bq_district == CA04_lpc_district& CA04_bq_district!=. & CA04_complete_district == 1 | CA04_bq_district == CA04_cpc_district& CA04_bq_district!=. & CA04_complete_district == 1 | CA04_bq_district == CA04_ndp_district & CA04_bq_district!=. & CA04_complete_district == 1 // The respondent gave his/her highest expectation score to the BQ candidate and at least one other candidate
replace CA04_forecast_ambiguous_district = 99 if CA04_cpc_district == CA04_lpc_district& CA04_cpc_district!=. & CA04_complete_district == 1 | CA04_cpc_district == CA04_bq_district & CA04_cpc_district!=. & CA04_complete_district == 1 | CA04_cpc_district == CA04_ndp_district & CA04_cpc_district!=. & CA04_complete_district == 1 // The respondent gave his/her highest expectation score to the CPC candidate and at least one other candidate
replace CA04_forecast_ambiguous_district = 99 if CA04_ndp_district == CA04_lpc_district& CA04_ndp_district!=. & CA04_complete_district == 1 | CA04_ndp_district == CA04_bq_district & CA04_ndp_district!=. & CA04_complete_district == 1 | CA04_ndp_district == CA04_cpc_district& CA04_ndp_district!=. & CA04_complete_district == 1 // The respondent gave his/her highest expectation score to the NDP candidate and at least one other candidate

* Generate a value of 0 for lower expectations

replace CA04_lpc_district = 0 if CA04_lpc_district!=1 & CA04_complete_district == 1 // The LPC candidate did not receive the highest expectation score given by the respondent
replace CA04_bq_district = 0 if CA04_bq_district!=1 & CA04_complete_district == 1 // The BQ candidate did not receive the highest expectation score given by the respondent
replace CA04_cpc_district = 0 if CA04_cpc_district!=1 & CA04_complete_district == 1 // The CPC candidate did not receive the highest expectation score given by the respondent
replace CA04_ndp_district = 0 if CA04_ndp_district!=1 & CA04_complete_district == 1 // The NDP candidate did not receive the highest expectation score given by the respondent
replace CA04_oth_district = 0 if CA04_oth_district!=1 & CA04_complete_district == 1 // Another candidate did not receive the highest expectation score given by the respondent

* Forecasts (1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 88 = other, 99 = ambiguous)

gen CA04_forecast_district = .

replace CA04_forecast_district = 1 if CA04_lpc_district == 1 & CA04_complete_district == 1 // The LPC candidate is the predicted winner
replace CA04_forecast_district = 4 if CA04_bq_district == 1 & CA04_complete_district == 1 // The BQ candidate is the predicted winner
replace CA04_forecast_district = 2 if CA04_cpc_district == 1 & CA04_complete_district == 1 // The CPC candidate is the predicted winner
replace CA04_forecast_district = 3 if CA04_ndp_district == 1 & CA04_complete_district == 1 // The NDP candidate is the predicted winner
replace CA04_forecast_district = 88 if CA04_oth_district == 1 & CA04_complete_district == 1 // Another candidate is the predicted winner
replace CA04_forecast_district = 99 if CA04_forecast_ambiguous_district == 99 & CA04_complete_district == 1 // Ambiguous forecast

* Identify correct and ambiguous forecasts

gen CA04_correct_district = 0 if CA04_forecast_district!=CA04_district_outcome & CA04_complete_district == 1 // The forecast is incorrect

replace CA04_correct_district = 1 if CA04_forecast_district == CA04_district_outcome & CA04_forecast_district!=99 & CA04_complete_district == 1 // The forecast is correct

replace CA04_correct_district = 0 if CA04_forecast_district == 99 & CA04_lpc_district!=1 & CA04_district_outcome == 1 & CA04_complete_district == 1 // The ambiguous forecast is incorrect since the LPC candidate is not among the candidates who received the highest score
replace CA04_correct_district = 0 if CA04_forecast_district == 99 & CA04_bq_district!=1 & CA04_district_outcome == 4 & CA04_complete_district == 1 // The ambiguous forecast is incorrect since the BQ candidate is not among the candidates who received the highest score
replace CA04_correct_district = 0 if CA04_forecast_district == 99 & CA04_cpc_district!=1 & CA04_district_outcome == 2 & CA04_complete_district == 1 // The ambiguous forecast is incorrect since the CPC candidate is not among the candidates who received the highest score
replace CA04_correct_district = 0 if CA04_forecast_district == 99 & CA04_ndp_district!=1 & CA04_district_outcome == 3 & CA04_complete_district == 1 // The ambiguous forecast is incorrect since the NDP candidate is not among the candidates who received the highest score

replace CA04_correct_district = 0 if ces04_cps_chance11 == 998 & ces04_cps_chance12 == 998 & ces04_cps_chance13 == 998 & ces04_cps_chance14 == 998 & ces04_province == 24 & CA04_complete_district == 1 // If the respondent answered DK for every candidate, treat as incorrect forecast
replace CA04_correct_district = 0 if ces04_cps_chance11 == 998 & ces04_cps_chance13 == 998 & ces04_cps_chance14 == 998 & ces04_province!=24 & CA04_complete_district == 1 // If the respondent answered DK for every candidate, treat as incorrect forecast

replace CA04_correct_district = 99 if CA04_forecast_district == 99 & CA04_lpc_district == 1 & CA04_district_outcome == 1 & CA04_complete_district == 1 // The forecast is truly ambiguous since the LPC candidate is among the candidates who received the highest score
replace CA04_correct_district = 99 if CA04_forecast_district == 99 & CA04_bq_district == 1 & CA04_district_outcome == 4 & CA04_complete_district == 1 // The forecast is truly ambiguous since the BQ candidate is among the candidates who received the highest score
replace CA04_correct_district = 99 if CA04_forecast_district == 99 & CA04_cpc_district == 1 & CA04_district_outcome == 2 & CA04_complete_district == 1 // The forecast is truly ambiguous since the CPC candidate is among the candidates who received the highest score
replace CA04_correct_district = 99 if CA04_forecast_district == 99 & CA04_ndp_district == 1 & CA04_district_outcome == 3 & CA04_complete_district == 1 // The forecast is truly ambiguous since the NDP candidate is among the candidates who received the highest score

replace CA04_correct_district = 0 if CA04_dk_forecast_district == 1 // Recode as incorrect if respondent answered "don't know" for every candidate
replace CA04_correct_district = . if CA04_no_forecast_district == 1 // Recode as missing data if respondent did not make any forecast

replace CA04_correct_district = . if ces04_fed03 == 59028 // An independent candidate won in Surrey North 

* Generate dichotomous variable (treat ambiguous forecasts as incorrect)

gen CA04_correct_district_d = CA04_correct_district 

replace CA04_correct_district_d = 0 if CA04_correct_district_d == 99 // Ambiguous forecasts are treated as incorrect
replace CA04_correct_district_d = 1 if CA04_correct_district_d == 1 

replace CA04_correct_district_d = . if ces04_fed03 == 59028 // An independent candidate won in Surrey North


********************************************************
** NATIONAL-LEVEL EXPECTATIONS: 2006 FEDERAL ELECTION **
********************************************************

* Forecasts (0 = other, 1 = Liberal, 2 = Conservative, 3 = NDP, 4 = BQ, 5 = Green)

gen CA06_forecast_whole = ces06_cps_chance1

recode CA06_forecast_whole (99=.) 

* Identify correct forecasts

gen CA06_correct_whole_d = 0 if CA06_forecast_whole!=2 & CA06_forecast_whole!=.
replace CA06_correct_whole_d = 1 if CA06_forecast_whole == 2


********************************************************
** DISTRICT-LEVEL EXPECTATIONS: 2006 FEDERAL ELECTION **
********************************************************

* Forecasts (0 = other, 1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 5 = GPC) - Party with best chance of winning

gen CA06_forecast_district = ces06_cps_chance7 

recode CA06_forecast_district (99=.) // Recode "refused" as missing data

* Generate dichotomous variable for each possible forecast

gen CA06_lpc = 1 if ces06_cps_chance7 == 1 // Respondent forecasted the LPC candidate would win
replace CA06_lpc = 0 if ces06_cps_chance7!=1 // Respondent did not forecast the LPC candidate would win

gen CA06_cpc = 1 if ces06_cps_chance7 == 2 // Respondent forecasted the CPC candidate would win
replace CA06_cpc = 0 if ces06_cps_chance7!=2 // Respondent did not forecast the CPC candidate would win

gen CA06_ndp = 1 if ces06_cps_chance7 == 3 // Respondent forecasted the NDP candidate would win
replace CA06_ndp = 0 if ces06_cps_chance7!=3 // Respondent did not forecast the NDP candidate would win

gen CA06_bq = 1 if ces06_cps_chance7 == 4 // Respondent forecasted the BQ candidate would win
replace CA06_bq = 0 if ces06_cps_chance7!=4 // Respondent did not forecast the BQ candidate would win

gen CA06_gpc = 1 if ces06_cps_chance7 == 5 // Respondent forecasted the GPC candidate would win
replace CA06_gpc = 0 if ces06_cps_chance7!=5 // Respondent did not forecast the GPC candidate would win

gen CA06_oth = 1 if ces06_cps_chance7 == 0 // Respondent forecasted another candidate would win
replace CA06_oth = 0 if ces06_cps_chance7!=0 // Respondent did not forecast another candidate would win

recode CA06_lpc CA06_cpc CA06_ndp CA06_bq CA06_gpc CA06_oth (99=.) // Recode "refused" as missing data

* Identify correct forecasts

gen CA06_correct_district_d = 0 if CA06_forecast_district!=CA06_district_outcome // The forecast is incorrect

replace CA06_correct_district_d = 1 if CA06_forecast_district == CA06_district_outcome & CA06_forecast_district!=. // The forecast is correct


********************************************************
** NATIONAL-LEVEL EXPECTATIONS: 2008 FEDERAL ELECTION **
********************************************************

* Forecasts (0 = other, 1 = Liberal, 2 = Conservative, 3 = NDP, 4 = BQ, 5 = Green)

gen CA08_forecast_whole = ces08_cps_chance1

recode CA08_forecast_whole (99=.) 

* Identify correct forecasts

gen CA08_correct_whole_d = 0 if CA08_forecast_whole!=2 & CA08_forecast_whole!=.
replace CA08_correct_whole_d = 1 if CA08_forecast_whole == 2


********************************************************
** DISTRICT-LEVEL EXPECTATIONS: 2008 FEDERAL ELECTION **
********************************************************

* Forecasts (0 = other, 1 = LPC, 2 = CPC, 3 = NDP, 4 = BQ, 5 = GPC) - Party with best chance of winning

gen CA08_forecast_district = ces08_cps_chance2

recode CA08_forecast_district (99=.) if ces_year == 2008 // Recode "refused" as missing data

* Generate dichotomous variable for each possible forecast

gen CA08_lpc = 1 if ces08_cps_chance2 == 1 // Respondent forecasted the LPC candidate would win
replace CA08_lpc = 0 if ces08_cps_chance2!=1 // Respondent did not forecast the LPC candidate would win

gen CA08_cpc = 1 if ces08_cps_chance2 == 2 // Respondent forecasted the CPC candidate would win
replace CA08_cpc = 0 if ces08_cps_chance2!=2 // Respondent did not forecast the CPC candidate would win

gen CA08_ndp = 1 if ces08_cps_chance2 == 3 // Respondent forecasted the NDP candidate would win
replace CA08_ndp = 0 if ces08_cps_chance2!=3 // Respondent did not forecast the NDP candidate would win

gen CA08_bq = 1 if ces08_cps_chance2 == 4 // Respondent forecasted the BQ candidate would win
replace CA08_bq = 0 if ces08_cps_chance2!=4 // Respondent did not forecast the BQ candidate would win

gen CA08_gpc = 1 if ces08_cps_chance2 == 5 // Respondent forecasted the GPC candidate would win
replace CA08_gpc = 0 if ces08_cps_chance2!=5 // Respondent did not forecast the GPC candidate would win

gen CA08_oth = 1 if ces08_cps_chance2 == 0 // Respondent forecasted another candidate would win
replace CA08_oth = 0 if ces08_cps_chance2!=0 // Respondent did not forecast another candidate would win

recode CA08_lpc CA08_cpc CA08_ndp CA08_bq CA08_gpc CA08_oth (99=.) // Recode "refused" as missing data

* Identify correct forecasts

gen CA08_correct_district_d = 0 if CA08_forecast_district!=CA08_district_outcome // The forecast is incorrect

replace CA08_correct_district_d = 1 if CA08_forecast_district == CA08_district_outcome & CA08_forecast_district!=. // The forecast is correct


**********
** SAVE **
**********

save "ca2004_2008_ces.dta", replace


******************************************
** MAIN ANALYSES: 2004 FEDERAL ELECTION **
******************************************

* Regression analysis and percentage of correct and incorrect forecasts (national)

logistic CA04_correct_whole_d CA04_discussion CA04_size CA04_pidscale_whole CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time if ces_year == 2004
estimates table, star(.05 .01 .001)

tab CA04_correct_district_d if e(sample) == 1

* Regression analysis and percentage of correct and incorrect forecasts (district)

melogit CA04_correct_district_d CA04_discussion CA04_size CA04_pidscale_district CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time CA04_enep if ces_year == 2004 || ces04_fed03: , or
estimates table, star(.05 .01 .001)

tab CA04_correct_district_d if e(sample) == 1


***********************************************
** SUMMARY STATISTICS: 2004 FEDERAL ELECTION **
***********************************************

label variable CA04_correct_whole_d "Most seats (DV)"
label variable CA04_correct_district_d "District winner (DV)"
label variable CA04_pidscale_whole "National PID"
label variable CA04_pidscale_district "District PID"
label variable CA04_discussion "Discussion"
label variable CA04_diversity "Network diversity"
label variable CA04_size "Network size"
label variable CA04_contact "Social contact"
label variable CA04_interest "Interest"
label variable CA04_news "News attentiveness"
label variable CA04_knowledge "Political knowledge"
label variable CA04_male "Gender (male = 1)"
label variable CA04_age "Age"
label variable CA04_education "Education"
label variable CA04_margin "Margin"
label variable CA04_enep "ENEP"
label variable CA04_time "Time of interview"

quietly logistic CA04_correct_whole_d CA04_discussion CA04_size CA04_pidscale_whole CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time if ces_year == 2004

estpost tabstat CA04_correct_whole_d CA04_discussion CA04_size CA04_pidscale_whole CA04_interest CA04_news CA04_knowledge CA04_male CA04_age CA04_education CA04_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2004_ces_summary_national.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2004 Canadian federal election (CES), national-level") replace

eststo clear

quietly melogit CA04_correct_district_d CA04_discussion CA04_size CA04_pidscale_district CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time CA04_enep if ces_year == 2004 || ces04_fed03: , or

estpost tabstat CA04_correct_district_d CA04_discussion CA04_size CA04_pidscale_district CA04_interest CA04_news CA04_knowledge CA04_male CA04_age CA04_education CA04_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2004_ces_summary_district.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2004 Canadian federal election (CES), district-level") replace

eststo clear


************************************************
** ADDITIONAL ANALYSES: 2004 FEDERAL ELECTION **
************************************************

* Regression analysis (national)

logistic CA04_correct_whole_d i.CA04_network_main CA04_discussion CA04_size CA04_pidscale_whole CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time if ces_year == 2004
estimates table, star(.05 .01 .001)

* Regression analysis (district)

melogit CA04_correct_district_d i.CA04_network_main CA04_discussion CA04_size CA04_pidscale_district CA04_interest CA04_news CA04_knowledge i.CA04_male CA04_age CA04_education CA04_time CA04_enep if ces_year == 2004 || ces04_fed03: , or
estimates table, star(.05 .01 .001)


***********************************************************
** MAIN ANALYSES: 2006 FEDERAL ELECTION - NATIONAL-LEVEL **
***********************************************************

* Regression analysis and percentage of correct and incorrect forecasts (national)

logistic CA06_correct_whole_d CA06_discussion CA06_pidscale_whole CA06_interest CA06_news CA06_knowledge i.CA06_male CA06_age CA06_education CA06_time if ces_year == 2006
estimates table, star(.05 .01 .001)

tab CA06_correct_district_d if e(sample) == 1


****************************************************************
** SUMMARY STATISTICS: 2006 FEDERAL ELECTION - NATIONAL-LEVEL **
****************************************************************

label variable CA06_correct_whole_d "Most seats (DV)"
label variable CA06_correct_district_d "District winner (DV)"
label variable CA06_pidscale_whole "National PID"
label variable CA06_pidscale_district "District PID"
label variable CA06_discussion "Discussion"
label variable CA06_interest "Interest"
label variable CA06_news "News attentiveness"
label variable CA06_knowledge "Political knowledge"
label variable CA06_male "Gender (male = 1)"
label variable CA06_age "Age"
label variable CA06_education "Education"
label variable CA06_margin "Margin"
label variable CA06_enep "ENEP"
label variable CA06_time "Time of interview"

estpost tabstat CA06_correct_whole_d CA06_discussion CA06_pidscale_whole CA06_interest CA06_news CA06_knowledge CA06_male CA06_age CA06_education CA06_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2006_ces_summary_national.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2006 Canadian federal election (CES), national-level") replace

eststo clear


*****************************************************************
** ADDITIONAL ANALYSES: 2006 FEDERAL ELECTION - NATIONAL-LEVEL **
*****************************************************************

* Regression analysis (national)

logistic CA06_correct_whole_d i.CA06_network_main CA06_discussion CA06_pidscale_whole CA06_interest CA06_news CA06_knowledge i.CA06_male CA06_age CA06_education CA06_time if ces_year == 2006
estimates table, star(.05 .01 .001)


***********************************************************
** MAIN ANALYSES: 2006 FEDERAL ELECTION - DISTRICT-LEVEL **
***********************************************************

* Regression analysis and percentage of correct and incorrect forecasts (district)

melogit CA06_correct_district_d CA06_discussion CA06_pidscale_district CA06_interest CA06_news CA06_knowledge i.CA06_male CA06_age CA06_education CA06_time CA06_enep if ces_year == 2006 || ces06_fed03: , or
estimates table, star(.05 .01 .001)

tab CA06_correct_district_d if e(sample) == 1


****************************************************************
** SUMMARY STATISTICS: 2006 FEDERAL ELECTION - DISTRICT-LEVEL **
****************************************************************

label variable CA06_correct_whole_d "Most seats (DV)"
label variable CA06_correct_district_d "District winner (DV)"
label variable CA06_pidscale_whole "National PID"
label variable CA06_pidscale_district "District PID"
label variable CA06_discussion "Discussion"
label variable CA06_interest "Interest"
label variable CA06_news "News attentiveness"
label variable CA06_knowledge "Political knowledge"
label variable CA06_male "Gender (male = 1)"
label variable CA06_age "Age"
label variable CA06_education "Education"
label variable CA06_margin "Margin"
label variable CA06_enep "ENEP"
label variable CA06_time "Time of interview"

estpost tabstat CA06_correct_district_d CA06_discussion CA06_pidscale_district CA06_interest CA06_news CA06_knowledge CA06_male CA06_age CA06_education CA06_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2006_ces_summary_district.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2006 Canadian federal election (CES), district-level") replace

eststo clear


*****************************************************************
** ADDITIONAL ANALYSES: 2006 FEDERAL ELECTION - DISTRICT-LEVEL **
*****************************************************************

* Regression analysis (district)

melogit CA06_correct_district_d i.CA06_network_main CA06_discussion CA06_pidscale_district CA06_interest CA06_news CA06_knowledge i.CA06_male CA06_age CA06_education CA06_time CA06_enep if ces_year == 2006 || ces06_fed03: , or
estimates table, star(.05 .01 .001)


******************************************
** MAIN ANALYSES: 2008 FEDERAL ELECTION **
******************************************

* Regression analysis and percentage of correct and incorrect forecasts (national)

logistic CA08_correct_whole_d CA08_discussion2 CA08_size CA08_pidscale_whole CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time if ces_year == 2008
estimates table, star(.05 .01 .001)

tab CA08_correct_district_d if e(sample) == 1

* Regression analysis and percentage of correct and incorrect forecasts (district)

melogit CA08_correct_district_d CA08_discussion2 CA08_size CA08_pidscale_district CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time CA08_enep if ces_year == 2008 || ces08_fed03: , or
estimates table, star(.05 .01 .001)

tab CA08_correct_district_d if e(sample) == 1


***********************************************
** SUMMARY STATISTICS: 2008 FEDERAL ELECTION **
***********************************************

label variable CA08_correct_whole_d "Most seats (DV)"
label variable CA08_correct_district_d "District winner (DV)"
label variable CA08_pidscale_whole "National PID"
label variable CA08_pidscale_district "District PID"
label variable CA08_discussion2 "Discussion"
label variable CA08_size "Network size"
label variable CA08_contact "Social contact"
label variable CA08_interest "Interest"
label variable CA08_news "News attentiveness"
label variable CA08_knowledge "Political knowledge"
label variable CA08_male "Gender (male = 1)"
label variable CA08_age "Age"
label variable CA08_education "Education"
label variable CA08_margin "Margin"
label variable CA08_enep "ENEP"
label variable CA08_time "Time of interview"

quietly logistic CA08_correct_whole_d CA08_discussion2 CA08_size CA08_pidscale_whole CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time if ces_year == 2008

estpost tabstat CA08_correct_whole_d CA08_discussion2 CA08_size CA08_pidscale_whole CA08_interest CA08_news CA08_knowledge CA08_male CA08_age CA08_education CA08_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2008_ces_summary_national.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2008 Canadian federal election (CES), national-level") replace

eststo clear

quietly melogit CA08_correct_district_d CA08_discussion2 CA08_size CA08_pidscale_district CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time CA08_enep if ces_year == 2008 || ces08_fed03: , or

estpost tabstat CA08_correct_district_d CA08_discussion2 CA08_size CA08_pidscale_district CA08_interest CA08_news CA08_knowledge CA08_male CA08_age CA08_education CA08_time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "ca2008_ces_summary_district.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.1f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2008 Canadian federal election (CES), district-level") replace

eststo clear


************************************************
** ADDITIONAL ANALYSES: 2008 FEDERAL ELECTION **
************************************************

* Regression analysis (national)

logistic CA08_correct_whole_d i.CA08_network_main CA08_discussion2 CA08_size CA08_pidscale_whole CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time if ces_year == 2008
estimates table, star(.05 .01 .001)

* Regression analysis (district)

melogit CA08_correct_district_d i.CA08_network_main CA08_discussion2 CA08_size CA08_pidscale_district CA08_interest CA08_news CA08_knowledge i.CA08_male CA08_age CA08_education CA08_time CA08_enep if ces_year == 2008 || ces08_fed03: , or
estimates table, star(.05 .01 .001)

log close